Updated static pages CRUD
This commit is contained in:
parent
93dc9903c5
commit
74cebd7eb3
3 changed files with 51 additions and 24 deletions
|
|
@ -52,4 +52,25 @@ enum StaticPageType: int
|
|||
self::we_listen,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the static page need to fill its 'content' column ?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function containsContent(): bool
|
||||
{
|
||||
return match ($this) {
|
||||
self::contact,
|
||||
self::legals,
|
||||
self::confidentiality => true,
|
||||
self::home,
|
||||
self::unveil,
|
||||
self::we_hire,
|
||||
self::we_commit,
|
||||
self::we_move,
|
||||
self::we_produce,
|
||||
self::we_listen => false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@
|
|||
'model' => $staticPageModel ?? null,
|
||||
'required' => false,
|
||||
'disabled' => true,
|
||||
'associatedModels' => \App\Enums\StaticPageType::toArray(),
|
||||
'associatedModels' => Arr::where(
|
||||
\App\Enums\StaticPageType::toArray(),
|
||||
fn(object $type) => $type->value === $staticPageModel->type->value),
|
||||
'helper' => '',
|
||||
])
|
||||
</div>
|
||||
|
|
@ -125,30 +127,32 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
{{-- CONTENT --}}
|
||||
<div class="col-12 mb-3">
|
||||
<fieldset class="border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.content')) }}</legend>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.text-html', [
|
||||
'id' => 'articleContent',
|
||||
'label' => __(':field :inter:model', [
|
||||
'field' => Str::ucfirst(__('validation.attributes.content')),
|
||||
'inter' => __('validation.custom.of_the.female'),
|
||||
'model' => trans_choice('models.classes.static_page', 1),
|
||||
]),
|
||||
'name' => 'content',
|
||||
'model' => $staticPageModel ?? null,
|
||||
'required' => true,
|
||||
'helper' => __('crud.minicrud.text_warning'),
|
||||
])
|
||||
@if ($staticPageModel->type->containsContent())
|
||||
<div class="row">
|
||||
{{-- CONTENT --}}
|
||||
<div class="col-12 mb-3">
|
||||
<fieldset class="border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.content')) }}</legend>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.text-html', [
|
||||
'id' => 'articleContent',
|
||||
'label' => __(':field :inter:model', [
|
||||
'field' => Str::ucfirst(__('validation.attributes.content')),
|
||||
'inter' => __('validation.custom.of_the.female'),
|
||||
'model' => trans_choice('models.classes.static_page', 1),
|
||||
]),
|
||||
'name' => 'content',
|
||||
'model' => $staticPageModel ?? null,
|
||||
'required' => true,
|
||||
'helper' => __('crud.minicrud.text_warning'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
|
|
|
|||
|
|
@ -54,7 +54,9 @@ Route::prefix('bo')
|
|||
'edit' => 'static_pages.edit',
|
||||
'update' => 'static_pages.update',
|
||||
])->parameters(['pages' => 'static_page'])
|
||||
->only(['index', 'edit', 'update']);
|
||||
->only(['index', 'edit', 'update'])
|
||||
->withoutMiddleware('htmlsanitize')
|
||||
->middleware('htmlsanitize:content');
|
||||
|
||||
// * NEWS.
|
||||
Route::resource('news', NewsController::class)->except('show')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue