--- /dev/null
+<?php
+
+namespace App\Fields;
+
+use App\SubForms\FluidbookChapter;
+use Cubist\Backpack\Magic\Fields\BunchOfFieldsMultiple;
+
+class FluidbookChapters extends BunchOfFieldsMultiple
+{
+ protected $_adminType = 'fluidbook_chapters';
+ protected $_viewNamespace='fields';
+ protected $_bunch = FluidbookChapter::class;
+ protected $_show_empty = false;
+}
namespace App\Models;
+use App\Fields\FluidbookChapters;
use App\Fields\FluidbookLocale;
use App\Fields\FluidbookTitle;
use App\Fields\User;
$this->addField('page_numbers', Textarea::class, __('Numérotation'));
$this->addField('section_theme', FormBigSection::class, __('Thème graphique'));
- $this->addField('theme', \App\Fields\FluidbookTheme::class,__('Thème'));
+ $this->addField('theme', \App\Fields\FluidbookTheme::class, __('Thème'));
$this->addField('section_locale', FormBigSection::class, __('Langue'));
$this->addField('locale', FluidbookLocale::class, __('Langue principale'), ['default' => 'fr', 'allows_null' => false, 'filter' => true, 'filter_label' => 'Langue', 'column' => true, 'column_label' => '<i class="la la-language"></i>']);
$this->addField('translations', \App\Fields\FluidbookTranslationOverwrite::class, __('Traductions personnalisées'));
$this->addField('section_chapters', FormBigSection::class, __('Sommaire'));
- $this->addField('chapters', Textarea::class, __('Sommaire'));
+ $this->addField('chapters', FluidbookChapters::class);
$this->addField('section_settings', FormSuperSection::class, __('Paramètres'));
--- /dev/null
+<?php
+
+namespace App\SubForms;
+
+use Cubist\Backpack\Magic\Fields\Color;
+use Cubist\Backpack\Magic\Fields\Hidden;
+use Cubist\Backpack\Magic\Fields\SelectFromArray;
+use Cubist\Backpack\Magic\Fields\Text;
+use Cubist\Backpack\Magic\SubForm;
+
+class FluidbookChapter extends SubForm
+{
+ public function init()
+ {
+ parent::init();
+
+
+ $when = ['type' => ['regular', 'column_head']];
+ $this->addField('label', Text::class, __('Nom du chapitre'), ['when' => $when]);
+ $this->addField('page', Text::class, __('Page'), ['when' => $when]);
+ $this->addField('color', Color::class, __('Couleur'), ['when' => $when]);
+ $this->addField('type', SelectFromArray::class, __('Type'), ['default' => 'regular', 'options' =>
+ [
+ 'regular' => __('Chapitre normal'),
+ 'column_head' => __('Titre de colonne') . ' (!!!)',
+ 'nocut' => __('Empêcher un passage à la colonne suivante') . ' (++)',
+ 'forcecut' => __('Forcer un passage à la colonne suivante') . ' (--)',
+ 'separator' => __('Séparateur') . ' (----)',
+ ]
+ ]);
+ $this->addField('level', Hidden::class, __('Niveau'));
+
+ }
+}
--- /dev/null
+@if (!isset($seenFluidbookChapters))
+ @php $seenFluidbookChapters=true;@endphp
+ @push('crud_fields_scripts')
+ <script>
+
+ </script>
+ @endpush
+
+ @push('crud_fields_styles')
+ <style>
+ .bunchmultiple_oneline .bunchmultiple__wrapper .item .legend .legendsize .form-group[data-name="label"] {
+ width: calc(100% - 330px);
+ }
+
+ .bunchmultiple_oneline .bunchmultiple__wrapper .item .legend .legendsize .form-group[data-name="page"] {
+ width: 100px;
+ }
+
+ .bunchmultiple_oneline .bunchmultiple__wrapper .item .legend .legendsize .form-group[data-name="color"] {
+ width: 70px;
+ }
+
+ .bunchmultiple_oneline .bunchmultiple__wrapper .item .legend .legendsize .form-group[data-name="type"] {
+ width: 160px;
+ }
+ </style>
+ @endpush
+@endif
+@include('cubist_back::fields.bunch_oneline_multiple')
+