From d5bce45c4b6ba6f2fa3c780b9b1617f1b3cecbce Mon Sep 17 00:00:00 2001 From: K Muller Date: Fri, 21 Nov 2025 16:17:23 +0100 Subject: [PATCH] fix: :bug: required validation on wysiwyg + :sparkles: adapt the hero to the new config --- .../Components/DynamicPages/DynamicInputs.tsx | 1 + .../back/Components/Inputs/SimpleWysiwyg.tsx | 11 +- .../views/components/front/hero.blade.php | 135 +++++++++++------- .../views/front/layouts/layout.blade.php | 23 +-- 4 files changed, 106 insertions(+), 64 deletions(-) diff --git a/resources/ts/back/Components/DynamicPages/DynamicInputs.tsx b/resources/ts/back/Components/DynamicPages/DynamicInputs.tsx index 455d7735..9ad76d82 100644 --- a/resources/ts/back/Components/DynamicPages/DynamicInputs.tsx +++ b/resources/ts/back/Components/DynamicPages/DynamicInputs.tsx @@ -104,6 +104,7 @@ export default function DynamicInputs({ { - setContent(changedValue); - setData(name, changedValue); + const value = stripHtmlTags(changedValue) ? changedValue : ''; + setContent(value); + setData(name, value); }; const customOptions: UseEditorOptions = { diff --git a/resources/views/components/front/hero.blade.php b/resources/views/components/front/hero.blade.php index 5aa2dfe9..45970f64 100644 --- a/resources/views/components/front/hero.blade.php +++ b/resources/views/components/front/hero.blade.php @@ -2,71 +2,98 @@ global $chirkashi; @endphp +@php + $firstHero = isset($dynamicPageModel) ? data_get($dynamicPageModel, 'content.list_hero.0', []) : []; + $mediaList = data_get($firstHero, 'list_media_list', []); + $hero = collect($mediaList) + ->map(function ($media, $index) use ($firstHero) { + return [ + 'title' => isset($firstHero['string_hero_title']) ? clean($firstHero['string_hero_title']) : null, + 'subtitle' => $firstHero['string_hero_subtitle'] ?? null, + 'text' => isset($firstHero['wysiwyg_hero_description']) + ? clean($firstHero['wysiwyg_hero_description']) + : null, + 'button' => [ + 'url' => data_get($firstHero, 'list_hero_cta.0.string_hero_cta_url'), + 'title' => data_get($firstHero, 'list_hero_cta.0.string_hero_cta_label'), + ], + 'video_file' => !empty($media['string_local_video']) ? asset($media['string_local_video']) : null, + 'image' => !empty($media['image_picture']) ? asset($media['image_picture']) : null, + 'image_borders' => [ + 'desktop' => ['left' => true, 'right' => true, 'top' => true, 'bottom' => true], + 'mobile' => ['left' => false, 'right' => false, 'top' => false, 'bottom' => true], + ], + ]; + }) + ->all(); +@endphp -@if(!empty($hero) and is_array($hero)) -
-
+@if (!empty($hero) and is_array($hero)) +
+
-
-
- @php +
+
+ @php $hero_i = 0; @endphp - @foreach($hero as $h) -
-
- @if(!empty($h['video_file'])) -
- -
- @endif -
- @if(!empty($h['title']) || !empty($h['subtitle']) || !empty($h['text'])) -
+ @foreach ($hero as $h) +
+
+ @if (!empty($h['video_file'])) +
+ +
+ @endif +
+ @if (!empty($h['title']) || !empty($h['subtitle']) || !empty($h['text'])) +
+ @if (!empty($h['title'])) + @if ($hero_i == 0) +

{!! $h['title'] !!}

+ @else +

{!! $h['title'] !!}

+ @endif + @endif - @if(!empty($h['title'])) - @if($hero_i == 0) -

{!! $h['title'] !!}

- @else -

{!! $h['title'] !!}

- @endif - @endif + @if (!empty($h['subtitle'])) +
{{ $h['subtitle'] }}
+ @endif - @if(!empty($h['subtitle'])) -
{{ $h['subtitle'] }}
- @endif - - @if(!empty($h['text'])) -
{!! $h['text'] !!}
- @endif - @if(!empty($h['button'])) - {{ $h["button"]["title"] }} - @endif - -
- @endif -
-
-
-
-
+ @if (!empty($h['text'])) +
{!! $h['text'] !!}
+ @endif + @if (!empty($h['button']) && isset($h['button']['url']) && isset($h['button']['title'])) + {{ $h['button']['title'] }} + @endif +
+ @endif +
+
+
+
+
-
+
-
- @php +
+ @php $hero_i++; @endphp - @endforeach -
-
-
-
-
+ @endforeach +
+
+
+
+
- + @include('front.breadcrumbs.breadcrumb-body') @endif diff --git a/resources/views/front/layouts/layout.blade.php b/resources/views/front/layouts/layout.blade.php index e285c0f9..c7cf8728 100644 --- a/resources/views/front/layouts/layout.blade.php +++ b/resources/views/front/layouts/layout.blade.php @@ -1,15 +1,19 @@ @php /** FIXME: Dans le wp, la méthode wp_is_mobile() est utilisée. - * Il faudra dapater les templates utilisant cette variable pour gérer le cas dans le style plutôt qu'en php j'imagine. - * $mob = wp_is_mobile() - */ + * Il faudra dapater les templates utilisant cette variable pour gérer le cas dans le style plutôt qu'en php j'imagine. + * $mob = wp_is_mobile() + */ $mob = true; global $chirkashi; - $chirkashi['top'] = 'chirk_top'; - $chirkashi['bottom'] = 'chirkashi_bottom'; - $chirkashi['left'] = ''; - $chirkashi['right'] = 'chirkashi_right'; + $chirkashi['top'] = + 'chirk_top'; + $chirkashi['bottom'] = + 'chirkashi_bottom'; + $chirkashi['left'] = + ''; + $chirkashi['right'] = + 'chirkashi_right'; @endphp @@ -20,7 +24,9 @@ @include('front.layouts.head') - + @include('front.layouts.top-nav-menu')
@include('front.layouts.header') @@ -29,6 +35,7 @@
+ @yield('content')