From d9629508be1c8d30d1840d130809f3ae8d303daa Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 18 Sep 2018 17:03:03 +0300 Subject: [PATCH 1/6] Fix custom label MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь в кастоме отобразятся лейбы. А то отнаследовались и не переделали --- src/Display/Column/Custom.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Display/Column/Custom.php b/src/Display/Column/Custom.php index 165c8cad8..828053348 100644 --- a/src/Display/Column/Custom.php +++ b/src/Display/Column/Custom.php @@ -31,6 +31,9 @@ class Custom extends NamedColumn public function __construct($label = null, Closure $callback = null) { parent::__construct($label); + if (! is_null($label)) { + $this->setLabel($label); + } if (! is_null($callback)) { $this->setCallback($callback); } From 87513d8b914b2b09bc39f85bb1fefa26f8cb1d29 Mon Sep 17 00:00:00 2001 From: Daan Date: Tue, 25 Sep 2018 23:32:27 +0300 Subject: [PATCH 2/6] Add boolean column --- CHANGELOG.md | 22 +++++++++----- resources/views/default/column/bln.blade.php | 8 +++++ src/Display/Column/Bln.php | 32 ++++++++++++++++++++ src/Factories/DisplayColumnFactory.php | 1 + 4 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 resources/views/default/column/bln.blade.php create mode 100644 src/Display/Column/Bln.php diff --git a/CHANGELOG.md b/CHANGELOG.md index bd9dfe180..9da29c3e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@

[Unreleased] (Only in development branch)

+* [Add] Добавлен новый тип столбца `AdminColumn::bln('active', 'Published'),` (алиас `text`) который просто рисует галочку при `true` и минус при `false`. Да еще и с равнением по центру. + Уже просто достало постоянно рисовать что-то типа: + ``` + AdminColumn::custom('Published', function ($instance) { + return $instance->active ? '' : '';}) + ->setHtmlAttribute('class', 'text-center'), + ``` + * [Feature] Добавлен ENV-редактор Для тех кто уже с нами: В sleeping_owl.php @@ -12,7 +20,7 @@ | */ 'env_editor_url' => 'env/editor', - + /* * * @@ -20,17 +28,17 @@ 'env_editor_excluded_keys' => [ 'APP_KEY', 'DB_*' ], - - + + 'env_editor_middlewares' => [], - + 'env_editor_policy' => Policy::class, - + 'show_editor' => false, ``` - - + + * [Feature] Subdomain routes for admin Вы должны добавить в sleeping_owl.php ключ 'domain' => 'admin.example.com' где example.com и будет ваш домен. * [Feature] Добавлено поведение для коламнов `text`, `link` и `relatedLink`. Может быть пропущен. diff --git a/resources/views/default/column/bln.blade.php b/resources/views/default/column/bln.blade.php new file mode 100644 index 000000000..7826f7207 --- /dev/null +++ b/resources/views/default/column/bln.blade.php @@ -0,0 +1,8 @@ +
+
+ {!! $value ? '' : '' !!} {!! $append !!} +
+ @if($small) + {!! $small !!} + @endif +
diff --git a/src/Display/Column/Bln.php b/src/Display/Column/Bln.php new file mode 100644 index 000000000..39a8fcb6d --- /dev/null +++ b/src/Display/Column/Bln.php @@ -0,0 +1,32 @@ + $this->getModelValue(), + 'small' => $this->getModelSmallValue(), + ]; + } +} diff --git a/src/Factories/DisplayColumnFactory.php b/src/Factories/DisplayColumnFactory.php index d66917c42..a0073dc52 100644 --- a/src/Factories/DisplayColumnFactory.php +++ b/src/Factories/DisplayColumnFactory.php @@ -47,6 +47,7 @@ public function __construct(\Illuminate\Contracts\Foundation\Application $applic 'lists' => Column\Lists::class, 'order' => Column\Order::class, 'text' => Column\Text::class, + 'bln' => Column\Bln::class, 'link' => Column\Link::class, 'relatedLink' => Column\RelatedLink::class, 'email' => Column\Email::class, From aab391102aaf4b35bd7eaca2d710b9d8195f50fd Mon Sep 17 00:00:00 2001 From: Daan Date: Wed, 26 Sep 2018 11:52:49 +0300 Subject: [PATCH 3/6] Fix bln name --- CHANGELOG.md | 2 +- .../views/default/column/{bln.blade.php => boolean.blade.php} | 0 src/Display/Column/{Bln.php => Boolean.php} | 4 ++-- src/Factories/DisplayColumnFactory.php | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) rename resources/views/default/column/{bln.blade.php => boolean.blade.php} (100%) rename src/Display/Column/{Bln.php => Boolean.php} (86%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9da29c3e0..0e11a95e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@

[Unreleased] (Only in development branch)

-* [Add] Добавлен новый тип столбца `AdminColumn::bln('active', 'Published'),` (алиас `text`) который просто рисует галочку при `true` и минус при `false`. Да еще и с равнением по центру. +* [Add] Добавлен новый тип столбца `AdminColumn::boolean('active', 'Published'),` (алиас `text`) который просто рисует галочку при `true` и минус при `false`. Да еще и с равнением по центру. Уже просто достало постоянно рисовать что-то типа: ``` AdminColumn::custom('Published', function ($instance) { diff --git a/resources/views/default/column/bln.blade.php b/resources/views/default/column/boolean.blade.php similarity index 100% rename from resources/views/default/column/bln.blade.php rename to resources/views/default/column/boolean.blade.php diff --git a/src/Display/Column/Bln.php b/src/Display/Column/Boolean.php similarity index 86% rename from src/Display/Column/Bln.php rename to src/Display/Column/Boolean.php index 39a8fcb6d..69d9cdab9 100644 --- a/src/Display/Column/Bln.php +++ b/src/Display/Column/Boolean.php @@ -2,12 +2,12 @@ namespace SleepingOwl\Admin\Display\Column; -class Bln extends NamedColumn +class Boolean extends NamedColumn { /** * @var string */ - protected $view = 'column.bln'; + protected $view = 'column.boolean'; /** * @var bool diff --git a/src/Factories/DisplayColumnFactory.php b/src/Factories/DisplayColumnFactory.php index a0073dc52..38f10add7 100644 --- a/src/Factories/DisplayColumnFactory.php +++ b/src/Factories/DisplayColumnFactory.php @@ -18,6 +18,7 @@ * @method Column\Lists lists($name, $label = null) * @method Column\Order order() * @method Column\Text text($name, $label = null) + * @method Column\Boolean text($name, $label = null) * @method Column\Link link($name, $label = null) * @method Column\RelatedLink relatedLink($name, $label = null) * @method Column\Email email($name, $label = null) @@ -47,7 +48,7 @@ public function __construct(\Illuminate\Contracts\Foundation\Application $applic 'lists' => Column\Lists::class, 'order' => Column\Order::class, 'text' => Column\Text::class, - 'bln' => Column\Bln::class, + 'boolean' => Column\Boolean::class, 'link' => Column\Link::class, 'relatedLink' => Column\RelatedLink::class, 'email' => Column\Email::class, From 03f3962def7c8d5b080ca9d32bd170942d69cf54 Mon Sep 17 00:00:00 2001 From: Daan Date: Wed, 26 Sep 2018 12:03:25 +0300 Subject: [PATCH 4/6] Fix description --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e11a95e1..396303b38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,15 @@

[Unreleased] (Only in development branch)

-* [Add] Добавлен новый тип столбца `AdminColumn::boolean('active', 'Published'),` (алиас `text`) который просто рисует галочку при `true` и минус при `false`. Да еще и с равнением по центру. - Уже просто достало постоянно рисовать что-то типа: +* [Add] Добавлен новый тип столбца `AdminColumn::boolean('active', 'Published'),` (алиас `text`) который просто рисует галочку при `true` и минус при `false`. C равнением по центру. + Замена коду: ``` + //было AdminColumn::custom('Published', function ($instance) { return $instance->active ? '' : '';}) ->setHtmlAttribute('class', 'text-center'), + + //станет + AdminColumn::boolean('active', 'Published'), ``` * [Feature] Добавлен ENV-редактор From b54fee834c5428e801bbb9a0878a6e32b71161e6 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 4 Oct 2018 21:56:08 +0300 Subject: [PATCH 5/6] =?UTF-8?q?=D0=A7=D1=82=D0=BE=D0=B1=20=D0=BA=D0=B5?= =?UTF-8?q?=D0=B4=D0=B8=D1=82=D0=BE=D1=80=20=D0=BD=D0=B5=20=D1=83=D0=B4?= =?UTF-8?q?=D0=B0=D0=BB=D1=8F=D0=BB=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit А то чистит чересчур уж --- config/sleeping_owl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/config/sleeping_owl.php b/config/sleeping_owl.php index 633f50c1f..b63075be0 100644 --- a/config/sleeping_owl.php +++ b/config/sleeping_owl.php @@ -160,6 +160,7 @@ 'ckeditor' => [ 'defaultLanguage' => config('app.locale'), 'height' => 200, + 'allowedContent' => false, 'extraPlugins' => 'uploadimage,image2,justify,youtube,uploadfile', /* * WARNING!!!! CKEDITOR on D & D and UploadImageDialog From eac019994ac7be5cd20b5c1828f36201281206c0 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 4 Oct 2018 22:12:53 +0300 Subject: [PATCH 6/6] =?UTF-8?q?=D0=A3=D0=BF=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/sleeping_owl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/sleeping_owl.php b/config/sleeping_owl.php index b63075be0..750caa773 100644 --- a/config/sleeping_owl.php +++ b/config/sleeping_owl.php @@ -160,7 +160,7 @@ 'ckeditor' => [ 'defaultLanguage' => config('app.locale'), 'height' => 200, - 'allowedContent' => false, + 'allowedContent' => true, 'extraPlugins' => 'uploadimage,image2,justify,youtube,uploadfile', /* * WARNING!!!! CKEDITOR on D & D and UploadImageDialog