Merge branch '342-tdf-feedbacks-v2' into 'develop'
fix: 🐛 handle feedback from another re7 review
See merge request ldc-web/projets/le-gaulois!340
This commit is contained in:
commit
0cd4c2d3cb
8 changed files with 138 additions and 21 deletions
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\InputType;
|
||||
use App\Enums\StaticPageType;
|
||||
use App\Models\StaticPage;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Collection::macro('replaceItem', function ($target, $value, $new_key = null) {
|
||||
$new = [];
|
||||
foreach ($this->items as $key => $old) {
|
||||
if ($key === $target) {
|
||||
$new[$new_key ?? $key] = $value;
|
||||
} else {
|
||||
$new[$key] = $old;
|
||||
}
|
||||
}
|
||||
$this->items = $new;
|
||||
});
|
||||
|
||||
Collection::macro('renameKey', function ($oldKey, $newKey) {
|
||||
$new = [];
|
||||
foreach ($this->items as $key => $value) {
|
||||
$new[$key === $oldKey ? $newKey : $key] = $value;
|
||||
}
|
||||
$this->items = $new;
|
||||
return $this;
|
||||
});
|
||||
|
||||
Schema::table('static_page_tdf', function (Blueprint $table) {
|
||||
$staticPageTdf = StaticPage::query()->where('type', StaticPageType::tdf)->first();
|
||||
if ($staticPageTdf) {
|
||||
$data = collect($staticPageTdf->data);
|
||||
|
||||
$data->renameKey('page_title', 'banner_page_title');
|
||||
$data->renameKey('highlight_text', 'banner_highlight_text');
|
||||
|
||||
$data->renameKey('heart_title', 'fun_facts_title');
|
||||
$data->renameKey('heart_subtitle', 'fun_facts_subtitle');
|
||||
$data->renameKey('heart_picture', 'fun_facts_picture');
|
||||
$data->renameKey('heart_picture_author', 'fun_facts_picture_author');
|
||||
|
||||
$data->renameKey('prize_title_1', 'play_prize_title_1');
|
||||
$data->renameKey('prize_picture_1', 'play_prize_picture_1');
|
||||
$data->renameKey('prize_title_2', 'play_prize_title_2');
|
||||
$data->renameKey('prize_picture_2', 'play_prize_picture_2');
|
||||
$data->renameKey('prize_title_3', 'play_prize_title_3');
|
||||
$data->renameKey('prize_picture_3', 'play_prize_picture_3');
|
||||
|
||||
$selectImageVideo = [
|
||||
'label' => 'Media de la section n°4',
|
||||
'inputType' => InputType::selectImageVideo->value,
|
||||
'value' => [
|
||||
"video" => [
|
||||
"id" => "hY0WPbkf4Ow",
|
||||
"alt" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
"title" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
|
||||
],
|
||||
],
|
||||
'validate' => 'required|array',
|
||||
'dimensions' => [
|
||||
'width' => 620,
|
||||
'height' => 348
|
||||
],
|
||||
'required' => true
|
||||
];
|
||||
|
||||
$data->replaceItem(
|
||||
"tdf_media",
|
||||
$selectImageVideo
|
||||
);
|
||||
|
||||
$staticPageTdf->data = $data->all();
|
||||
$staticPageTdf->saveQuietly();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('static_page_tdf', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -2,3 +2,7 @@
|
|||
color: $primary;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.max-h-svg {
|
||||
max-height: 70px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@
|
|||
<div>
|
||||
<img
|
||||
v-if="fileDataUrl"
|
||||
class="img-fluid"
|
||||
:class="`img-fluid ${isSvg ? 'max-h-svg' : ''}`"
|
||||
:src="fileDataUrl"
|
||||
:alt="trans.methods.__('Image placeholder')"
|
||||
:aria-describedby="`PreviewHelp${parameters.id}`"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,24 @@
|
|||
{{-- MINI CRUD EDIT WHEN JSON IS TRANSLATABLE --}}
|
||||
@php
|
||||
$lastPrefix = null;
|
||||
@endphp
|
||||
@foreach ($data as $k => $input)
|
||||
@if (!isset($input['inputType']))
|
||||
@continue
|
||||
@endif
|
||||
|
||||
@if ($model->type === \App\Enums\StaticPageType::tdf)
|
||||
@php
|
||||
$prefix = str_contains($k, '_') ? explode('_', $k)[0] : null;
|
||||
$displaySeparator = $lastPrefix !== null && $prefix !== $lastPrefix;
|
||||
$lastPrefix = $prefix;
|
||||
@endphp
|
||||
|
||||
@if ($displaySeparator)
|
||||
<div class="my-4"></div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@switch(intval($input['inputType']))
|
||||
@case(intval(\App\Enums\InputType::string->value))
|
||||
<div class="minicrud-input col-12 col-md-6 mb-3">
|
||||
|
|
|
|||
|
|
@ -32,15 +32,15 @@
|
|||
@endphp
|
||||
<section id="au-coeur-de-la-caravane">
|
||||
<h2 class="fw-bold text-uppercase mb-md-5 mb-0 text-center">
|
||||
{{ $model->data['heart_title']['value'] }}
|
||||
{{ $model->data['fun_facts_title']['value'] }}
|
||||
</h2>
|
||||
<div class="position-relative line-border-large">
|
||||
<div class="position-absolute left-100 w-100 d-none d-md-block start-0 z-0">
|
||||
<img
|
||||
class="img-fluid w-100 h-auto"
|
||||
src="{{ asset($model->data['heart_picture']['value']) }}"
|
||||
title="{{ $model->data['heart_picture']['title'] }}"
|
||||
alt="{{ $model->data['heart_picture']['alt'] }}"
|
||||
src="{{ asset($model->data['fun_facts_picture']['value']) }}"
|
||||
title="{{ $model->data['fun_facts_picture']['title'] }}"
|
||||
alt="{{ $model->data['fun_facts_picture']['alt'] }}"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
<div class="col-lg-7">
|
||||
<div class="rounded-3 position-relative line-border-medium bg-white p-4 shadow">
|
||||
<h4 class="fw-bold fs-2 text-uppercase mb-5 text-center">
|
||||
{{ $model->data['heart_subtitle']['value'] }}
|
||||
{{ $model->data['fun_facts_subtitle']['value'] }}
|
||||
</h4>
|
||||
<div>
|
||||
@foreach ($anecdotes as $a)
|
||||
|
|
@ -80,5 +80,5 @@
|
|||
</div>
|
||||
</section>
|
||||
<div class="ms-md-5 mt-4 d-none d-md-block">
|
||||
<small>{{ $model->data['heart_picture_author']['value'] }}</small>
|
||||
<small>{{ $model->data['fun_facts_picture_author']['value'] }}</small>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -27,24 +27,24 @@
|
|||
<div class="row text-center">
|
||||
<div class="col-4">
|
||||
<img class="images-100-percent mb-1"
|
||||
src="{{ asset($model->data['prize_picture_1']['value']) }}"
|
||||
title="{{ $model->data['prize_picture_1']['title'] }}"
|
||||
alt="{{ $model->data['prize_picture_1']['alt'] }}">
|
||||
<div class="fw-bold text-uppercase">{{ $model->data['prize_title_1']['value'] }}</div>
|
||||
src="{{ asset($model->data['play_prize_picture_1']['value']) }}"
|
||||
title="{{ $model->data['play_prize_picture_1']['title'] }}"
|
||||
alt="{{ $model->data['play_prize_picture_1']['alt'] }}">
|
||||
<div class="fw-bold text-uppercase">{{ $model->data['play_prize_title_1']['value'] }}</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<img class="images-100-percent mb-1"
|
||||
src="{{ asset($model->data['prize_picture_2']['value']) }}"
|
||||
title="{{ $model->data['prize_picture_2']['title'] }}"
|
||||
alt="{{ $model->data['prize_picture_2']['alt'] }}">
|
||||
<div class="fw-bold text-uppercase">{{ $model->data['prize_title_2']['value'] }}</div>
|
||||
src="{{ asset($model->data['play_prize_picture_2']['value']) }}"
|
||||
title="{{ $model->data['play_prize_picture_2']['title'] }}"
|
||||
alt="{{ $model->data['play_prize_picture_2']['alt'] }}">
|
||||
<div class="fw-bold text-uppercase">{{ $model->data['play_prize_title_2']['value'] }}</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<img class="images-100-percent mb-1"
|
||||
src="{{ asset($model->data['prize_picture_3']['value']) }}"
|
||||
title="{{ $model->data['prize_picture_3']['title'] }}"
|
||||
alt="{{ $model->data['prize_picture_3']['alt'] }}">
|
||||
<div class="fw-bold text-uppercase">{{ $model->data['prize_title_3']['value'] }}</div>
|
||||
src="{{ asset($model->data['play_prize_picture_3']['value']) }}"
|
||||
title="{{ $model->data['play_prize_picture_3']['title'] }}"
|
||||
alt="{{ $model->data['play_prize_picture_3']['alt'] }}">
|
||||
<div class="fw-bold text-uppercase">{{ $model->data['play_prize_title_3']['value'] }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="position-relative d-flex flex-column justify-content-center hero-section container pb-5 pt-5">
|
||||
<div class="row justify-content-center pt-5">
|
||||
<div class="col-12 col-lg-10 rounded-3 position-relative line-border-medium bg-white p-5 shadow">
|
||||
<span class="badge bg-warning fs-5 mb-2 p-2 text-white">{{ $model->data['highlight_text']['value'] }}</span>
|
||||
<span class="badge bg-warning fs-5 mb-2 p-2 text-white">{{ $model->data['banner_highlight_text']['value'] }}</span>
|
||||
<div class="text-muted small mb-2">
|
||||
@include('modules.breadcrumbs.breadcrumb-body', ['brParam' => $model])
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -183,5 +183,5 @@ Breadcrumbs::for('fo.contact.show', function (Generator $trail) {
|
|||
// * TDF
|
||||
Breadcrumbs::for('fo.tdf', function (Generator $trail, StaticPage $staticPage) {
|
||||
$trail->parent('fo.home.show');
|
||||
$trail->push(Str::of($staticPage->data['page_title']['value'])->ucfirst(), route('fo.tdf', $staticPage));
|
||||
$trail->push(Str::of($staticPage->data['banner_page_title']['value'])->ucfirst(), route('fo.tdf', $staticPage));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue