From cd14f373ea54c48020c28a06578e540b25319978 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 12 Sep 2022 19:49:00 +0200 Subject: [PATCH] wip #5448 @0:20 --- app/Models/ToolSVGSprite.php | 17 +++++++++++++++-- scripts/update | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/Models/ToolSVGSprite.php b/app/Models/ToolSVGSprite.php index db0198c70..c4cdd0166 100644 --- a/app/Models/ToolSVGSprite.php +++ b/app/Models/ToolSVGSprite.php @@ -7,6 +7,7 @@ use App\Models\Base\ToolboxModel; use App\SubForms\ToolSVGSpriteIcon; use Cubist\Backpack\Magic\Fields\BunchOfFieldsMultiple; use Cubist\Backpack\Magic\Fields\Text; +use Fluidbook\Tools\SVG\SVGTools; class ToolSVGSprite extends ToolboxModel { @@ -26,9 +27,21 @@ class ToolSVGSprite extends ToolboxModel $this->addOwnerField(); - $this->addField('name', Text::class, __('Nom'), ['column' => true]); $this->addField('prefix', Text::class, __('Préfixe'), ['column' => true]); - $this->addField('icons', BunchOfFieldsMultiple::class, __('Icônes'), ['bunch' => ToolSVGSpriteIcon::class, 'edit_label' => __('Edit :icon :name', ['name' => '%iconname','icon'=>'
%svgcode
']), 'add_label' => __('Ajouter une icône')]); + $this->addField('icons', BunchOfFieldsMultiple::class, __('Icônes'), ['bunch' => ToolSVGSpriteIcon::class, 'edit_label' => __('Edit :icon :name', ['name' => '%iconname', 'icon' => '
%svgcode
']), 'add_label' => __('Ajouter une icône')]); + } + + public function preSave() + { + parent::preSave(); + $icons = []; + foreach ($this->icons as $k => $icon) { + $icon['svgcode'] = SVGTools::optimizeSVGStr($icon['svgcode']); + $icons[$k] = $icon; + } + $this->icons = $icons; + } + } diff --git a/scripts/update b/scripts/update index 6604470a2..1dfef82ce 100644 --- a/scripts/update +++ b/scripts/update @@ -19,3 +19,5 @@ sudo chown -R 1001:33 /application/storage/framework php artisan optimize:clear php artisan cubist:magic:precache sudo chown -R 1001:33 /application/storage/framework +sudo chown -R 1001:33 /application/vendor +sudo chown -R 0:0 /etc/sudoers.d/toolbox -- 2.39.5