-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 2.0: (90 commits) Removing old stylist command Using ::class notation Using ::class notation Preparing 2.5.0 versions Preparing 2.5.0 changelogs CLosing css stack Using the @Push js stacks over the scripts section Using the @Push css stacks over the styles section New changelog item Remove the ckeditor inclusion on create/edit view stubs Adding changelog item Adding back the correct old input for the body field Adding changelog item for core module Creating a non translatable textarea component and make it usable with same @editor directive Fixing field name variable echo Moving assets inclusion to component Using new blade directives Bringing back the js and css stacks on main views Moving css and js stacks outside the component. Making field and label name dynamic Create a blade directive to use @editor ...
- Loading branch information
Showing
145 changed files
with
2,334 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Modules\Core\Blade; | ||
|
||
class AsgardEditorDirective | ||
{ | ||
private $content; | ||
private $lang; | ||
private $fieldName; | ||
private $labelName; | ||
|
||
public function show($arguments) | ||
{ | ||
$this->extractArguments($arguments); | ||
|
||
if ($this->lang !== null) { | ||
return asgard_i18n_editor($this->fieldName, $this->labelName, $this->content, $this->lang); | ||
} | ||
return asgard_editor($this->fieldName, $this->labelName, $this->content); | ||
} | ||
|
||
/** | ||
* Extract the possible arguments as class properties | ||
* @param array $arguments | ||
*/ | ||
private function extractArguments(array $arguments) | ||
{ | ||
$this->fieldName = array_get($arguments, 0); | ||
$this->labelName = array_get($arguments, 1); | ||
$this->content = array_get($arguments, 2); | ||
$this->lang = array_get($arguments, 3); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Modules\Core\Blade\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class AsgardEditorDirective extends Facade | ||
{ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return 'core.asgard.editor'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,9 @@ | |
'workshop', | ||
'setting', | ||
'media', | ||
'tag', | ||
'page', | ||
'translation', | ||
], | ||
|
||
/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Modules\Core\Contracts; | ||
|
||
interface EntityIsChanging | ||
{ | ||
/** | ||
* Get the attributes used to create or modify an entity | ||
* @return array | ||
*/ | ||
public function getAttributes(); | ||
/** | ||
* Set the attributes used to create or modify an entity | ||
* @param array $attributes | ||
*/ | ||
public function setAttributes(array $attributes); | ||
/** | ||
* Get the original attributes untouched by other listeners | ||
* @return array | ||
*/ | ||
public function getOriginal(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace Modules\Core\Events; | ||
|
||
abstract class AbstractEntityHook | ||
{ | ||
/** | ||
* Contains the attributes which can be changed by other listeners | ||
* @var array | ||
*/ | ||
private $attributes; | ||
/** | ||
* Contains the original attributes which cannot be changed | ||
* @var array | ||
*/ | ||
private $original; | ||
|
||
public function __construct(array $attributes) | ||
{ | ||
$this->attributes = $attributes; | ||
$this->original = $attributes; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getAttributes() | ||
{ | ||
return $this->attributes; | ||
} | ||
|
||
/** | ||
* @param string $attribute | ||
* @param null $default | ||
* @return string|null | ||
*/ | ||
public function getAttribute($attribute, $default = null) | ||
{ | ||
return data_get($this->attributes, $attribute, $default); | ||
} | ||
|
||
/** | ||
* @param array $attributes | ||
*/ | ||
public function setAttributes(array $attributes) | ||
{ | ||
$this->attributes = array_replace_recursive($this->attributes, $attributes); | ||
} | ||
|
||
/** | ||
* @param string|null $key | ||
* @param string|null $default | ||
* @return array | ||
*/ | ||
public function getOriginal($key = null, $default = null) | ||
{ | ||
if ($key !== null) { | ||
return data_get($this->original, $key, $default); | ||
} | ||
|
||
return $this->original; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace Modules\Core\Events; | ||
|
||
use Modules\Core\Foundation\Asset\Pipeline\AssetPipeline; | ||
|
||
class CollectingAssets | ||
{ | ||
/** | ||
* @var AssetPipeline | ||
*/ | ||
private $assetPipeline; | ||
|
||
public function __construct(AssetPipeline $assetPipeline) | ||
{ | ||
$this->assetPipeline = $assetPipeline; | ||
} | ||
|
||
/** | ||
* @param string $asset | ||
* @return AssetPipeline | ||
*/ | ||
public function requireJs($asset) | ||
{ | ||
return $this->assetPipeline->requireJs($asset); | ||
} | ||
|
||
/** | ||
* @param string $asset | ||
* @return AssetPipeline | ||
*/ | ||
public function requireCss($asset) | ||
{ | ||
return $this->assetPipeline->requireCss($asset); | ||
} | ||
|
||
/** | ||
* Match a single route | ||
* @param string|array $route | ||
* @return bool | ||
*/ | ||
public function onRoute($route) | ||
{ | ||
$request = request(); | ||
|
||
return str_is($route, $request->route()->getName()); | ||
} | ||
|
||
/** | ||
* Match multiple routes | ||
* @param array $routes | ||
* @return bool | ||
*/ | ||
public function onRoutes(array $routes) | ||
{ | ||
$request = request(); | ||
|
||
foreach ($routes as $route) { | ||
if (str_is($route, $request->route()->getName()) === true) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?php | ||
|
||
namespace Modules\Core\Events; | ||
|
||
use Modules\Core\Foundation\Asset\Pipeline\AssetPipeline; | ||
|
||
class EditorIsRendering | ||
{ | ||
/** | ||
* @var AssetPipeline | ||
*/ | ||
private $assetPipeline; | ||
private $editorClass; | ||
private $editorJsPartial; | ||
private $editorCssPartial; | ||
private $editorComponents = [ | ||
'i18n' => 'core::components.i18n.textarea', | ||
'normal' => 'core::components.textarea', | ||
]; | ||
|
||
public function __construct(AssetPipeline $assetPipeline) | ||
{ | ||
$this->assetPipeline = $assetPipeline; | ||
} | ||
|
||
public function addJs($asset) | ||
{ | ||
$this->assetPipeline->requireJs($asset); | ||
|
||
return $this; | ||
} | ||
|
||
public function addCss($asset) | ||
{ | ||
$this->assetPipeline->requireCss($asset); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getEditorClass() | ||
{ | ||
return $this->editorClass; | ||
} | ||
|
||
/** | ||
* @param mixed $editorClass | ||
*/ | ||
public function setEditorClass($editorClass) | ||
{ | ||
$this->editorClass = $editorClass; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getEditorJsPartial() | ||
{ | ||
return $this->editorJsPartial; | ||
} | ||
|
||
/** | ||
* @param mixed $editorJsPartial | ||
*/ | ||
public function setEditorJsPartial($editorJsPartial) | ||
{ | ||
$this->editorJsPartial = $editorJsPartial; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getEditorCssPartial() | ||
{ | ||
return $this->editorCssPartial; | ||
} | ||
|
||
/** | ||
* @param mixed $editorCssPartial | ||
*/ | ||
public function setEditorCssPartial($editorCssPartial) | ||
{ | ||
$this->editorCssPartial = $editorCssPartial; | ||
} | ||
|
||
public function getI18nComponentName() | ||
{ | ||
return $this->editorComponents['i18n']; | ||
} | ||
|
||
public function setI18nComponentName($componentName) | ||
{ | ||
$this->editorComponents['i18n'] = $componentName; | ||
} | ||
|
||
public function getComponentName() | ||
{ | ||
return $this->editorComponents['normal']; | ||
} | ||
|
||
public function setComponentName($componentName) | ||
{ | ||
$this->editorComponents['normal'] = $componentName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Modules\Core\Events\Handlers; | ||
|
||
use Modules\Core\Events\EditorIsRendering; | ||
|
||
class LoadCkEditor | ||
{ | ||
public function handle(EditorIsRendering $editor) | ||
{ | ||
$editor->addJs('ckeditor.js'); | ||
$editor->setEditorClass('ckeditor'); | ||
|
||
return false; | ||
} | ||
} |
Oops, something went wrong.