From 43b5602660d4ce1fd16b2bb236e05e032bd3695c Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 16 Aug 2022 18:38:40 +0200 Subject: [PATCH] wip #5383 @4 --- app/Console/Commands/WorkshopMigration.php | 8 ++++++-- app/Fields/FluidbookChapters.php | 10 +++++----- app/SubForms/FluidbookChapter.php | 3 ++- resources/views/fields/fluidbook_chapters.blade.php | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/Console/Commands/WorkshopMigration.php b/app/Console/Commands/WorkshopMigration.php index e4e5206c9..c7a7b6636 100644 --- a/app/Console/Commands/WorkshopMigration.php +++ b/app/Console/Commands/WorkshopMigration.php @@ -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; diff --git a/app/Fields/FluidbookChapters.php b/app/Fields/FluidbookChapters.php index 6a8f057c6..b300d23ea 100644 --- a/app/Fields/FluidbookChapters.php +++ b/app/Fields/FluidbookChapters.php @@ -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; } diff --git a/app/SubForms/FluidbookChapter.php b/app/SubForms/FluidbookChapter.php index a3846ba85..085c1bb29 100644 --- a/app/SubForms/FluidbookChapter.php +++ b/app/SubForms/FluidbookChapter.php @@ -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') . ' (!!!)', diff --git a/resources/views/fields/fluidbook_chapters.blade.php b/resources/views/fields/fluidbook_chapters.blade.php index d661b82f4..95a712ca4 100644 --- a/resources/views/fields/fluidbook_chapters.blade.php +++ b/resources/views/fields/fluidbook_chapters.blade.php @@ -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; } -- 2.39.5