]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5448 @0:20
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 12 Sep 2022 17:49:00 +0000 (19:49 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 12 Sep 2022 17:49:00 +0000 (19:49 +0200)
app/Models/ToolSVGSprite.php
scripts/update

index db0198c7091cf938a0a952ce07ae4866ec02f48b..c4cdd0166012b8f52887e51f90a2e5793006fcf1 100644 (file)
@@ -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'=>'<div class="icon">%svgcode</div>']), 'add_label' => __('Ajouter une icône')]);
+        $this->addField('icons', BunchOfFieldsMultiple::class, __('Icônes'), ['bunch' => ToolSVGSpriteIcon::class, 'edit_label' => __('Edit :icon :name', ['name' => '%iconname', 'icon' => '<div class="icon">%svgcode</div>']), '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;
+
     }
+
 }
index 6604470a208a84f64f6378d1437b0b520c35abab..1dfef82ce5872f4d737ac1781c4038232f570633 100644 (file)
@@ -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