]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5383 @4
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 16 Aug 2022 16:38:40 +0000 (18:38 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 16 Aug 2022 16:38:40 +0000 (18:38 +0200)
app/Console/Commands/WorkshopMigration.php
app/Fields/FluidbookChapters.php
app/SubForms/FluidbookChapter.php
resources/views/fields/fluidbook_chapters.blade.php

index e4e5206c9878702bf161d027fc9f61a7f8eb3a1f..c7a7b663659a42a31ef997425d47f01d41a444a6 100644 (file)
@@ -110,8 +110,12 @@ class WorkshopMigration extends CubistCommand
         $bookmarks = $this->_unserialize($bookmarks, $default);
         $res = [];
         foreach ($bookmarks as $bookmark) {
-            $bookmark['title'] = $bookmark['titre'];
-            unset($bookmark['titre']);
+            if (isset($bookmark['titre'])) {
+                $bookmark['title'] = $bookmark['titre'];
+                unset($bookmark['titre']);
+            } else {
+                $bookmark['title'] = '';
+            }
             $res[] = $bookmark;
         }
         return $res;
index 6a8f057c6f8642ca957763d230c62be07eec7e9d..b300d23ea71bb28ff752df065ab46d67ec1e38cb 100644 (file)
@@ -32,20 +32,20 @@ class FluidbookChapters extends BunchOfFieldsMultiple
         }
         $res = [];
         foreach ($v as $k => $chapter) {
-            $chapter['type'] = 'regular';
+            $chapter['decoration'] = 'regular';
             $chapter['label'] = trim($chapter['label']);
             if ($chapter['label'] === '----') {
                 $chapter['label'] = '';
-                $chapter['type'] = 'separator';
+                $chapter['decoration'] = 'separator';
             } else if ($chapter['label'] === '--') {
                 $chapter['label'] = '';
-                $chapter['type'] = 'forcecut';
+                $chapter['decoration'] = 'forcecut';
             } else if ($chapter['label'] === '++') {
                 $chapter['label'] = '';
-                $chapter['type'] = 'nocut';
+                $chapter['decoration'] = 'nocut';
             } else if (str_starts_with($chapter['label'], '!!!')) {
                 $chapter['label'] = substr($chapter['label'], 3);
-                $chapter['type'] = 'column_head';
+                $chapter['decoration'] = 'column_head';
             }
             $res[$k] = $chapter;
         }
index a3846ba8576f59d92a4ff3be7d51d9ea3b1a2c00..085c1bb29090696c902f8887af9d94b9d0541b20 100644 (file)
@@ -4,6 +4,7 @@ namespace App\SubForms;
 
 use App\Fields\FluidbookChapterLevel;
 use Cubist\Backpack\Magic\Fields\Color;
+use Cubist\Backpack\Magic\Fields\Field;
 use Cubist\Backpack\Magic\Fields\SelectFromArray;
 use Cubist\Backpack\Magic\Fields\Text;
 use Cubist\Backpack\Magic\SubForm;
@@ -18,7 +19,7 @@ class FluidbookChapter extends SubForm
         $this->addField('label', Text::class, __('Nom du chapitre'), ['when' => $when, 'placeholder' => __('Label')]);
         $this->addField('page', Text::class, __('Page'), ['when' => $when, 'placeholder' => __('Page')]);
         $this->addField('color', Color::class, __('Couleur'), ['when' => $when, 'allows_empty' => true, 'allows_alpha' => false, 'default' => null]);
-        $this->addField('type', SelectFromArray::class, __('Type'), ['default' => 'regular', 'options' =>
+        $this->addField('decoration', SelectFromArray::class, __('Type'), ['ajax' => false,  'allows_null' => false, 'options' =>
             [
                 'regular' => __('Chapitre normal'),
                 'column_head' => __('Titre de colonne') . ' (!!!)',
index d661b82f46e3a3a86d88465cc1eb2b38c7737250..95a712ca44d973ff5373523ae75668244e219abf 100644 (file)
@@ -60,7 +60,7 @@
                 width: 54px;
             }
 
-            .bunchmultiple_oneline .bunchmultiple__wrapper .item .legend .legendsize .form-group[data-name="type"] {
+            .bunchmultiple_oneline .bunchmultiple__wrapper .item .legend .legendsize .form-group[data-name="decoration"] {
                 width: 160px;
             }
         </style>