Merge branch 'commitments' into 'develop'
fix: 🐛 update commitments pages with youtube videos
See merge request ldc-web/projets/ldc!88
This commit is contained in:
commit
aa17ac45ce
7 changed files with 137 additions and 112 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -18,6 +18,7 @@
|
|||
/public/storage
|
||||
/storage/*.key
|
||||
/storage/pail
|
||||
/storage/uploads
|
||||
/vendor
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
|
|
|
|||
|
|
@ -2660,6 +2660,19 @@ a.copyright__item:hover {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.our-commitment .textblock__image iframe {
|
||||
aspect-ratio: 16 / 9;
|
||||
width: 100%;
|
||||
height: initial;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1600px) {
|
||||
.our-commitment .textblock__image.textblock__block:has(.brand__video),
|
||||
.our-commitment .textblock__image.textblock__block .brand__video {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.textblock__info-description.quote__text {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
@ -2705,7 +2718,9 @@ a.copyright__item:hover {
|
|||
}
|
||||
|
||||
.textblock__container_row .textblock__image img {
|
||||
width: auto;
|
||||
height: auto;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.textblock__container_row.textblock__container_swap .textblock__image {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ type SimpleYoutubeIdProps = {
|
|||
};
|
||||
|
||||
export default function SimpleYoutubeId(props: SimpleYoutubeIdProps) {
|
||||
const pattern = "^[0-9A-Za-z_-]{10}[048AEIMQUYcgkosw]$";
|
||||
const pattern = "^[0-9A-Za-z_\\-]{10}[048AEIMQUYcgkosw]$";
|
||||
const label = str(useTrans('validation.custom.youtube_id')).ucFirst().value();
|
||||
const localProps = {pattern, label, ...props};
|
||||
|
||||
|
|
|
|||
|
|
@ -47,10 +47,6 @@
|
|||
@if (!empty($l['image']) || !empty($l['video']))
|
||||
<div class="textblock__image textblock__block">
|
||||
@if (!empty($l['video']))
|
||||
{{-- <div class="textblock__video video-wrap">
|
||||
<div class="textblock__video-btn play-button"></div>
|
||||
{{ $l['video'] }}
|
||||
</div> --}}
|
||||
<x-front.sections.video :video="[
|
||||
'type_video' => $l['video']['type_video'],
|
||||
'video' => $l['video']['video'],
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
<span class="title-text">{!! $video['title'] !!}</span>
|
||||
@if (!empty($video['subtitle']))
|
||||
<span @class([
|
||||
'manifest__subtitle subtitle-text textblock__subtitle subtitle',
|
||||
'subtitle_paint' => $video['subtitle']['cursive']
|
||||
])>
|
||||
'manifest__subtitle subtitle-text textblock__subtitle subtitle',
|
||||
'subtitle_paint' => $video['subtitle']['cursive']
|
||||
])>
|
||||
{!! $video['subtitle']['text'] !!}
|
||||
</span>
|
||||
@endif
|
||||
|
|
@ -20,14 +20,13 @@
|
|||
<div class="play-button"></div>
|
||||
@php
|
||||
$videoUrl = strpos($video['video'], 'https') === 0 ?
|
||||
$video['video'] : (
|
||||
$video['type_video'] === 'youtube' ?
|
||||
'https://www.youtube.com/embed/' : 'https://player.vimeo.com/video/'
|
||||
) . $video['video'];
|
||||
$video['video']
|
||||
: ($video['type_video'] === 'youtube'
|
||||
? 'https://www.youtube.com/embed/'
|
||||
: 'https://player.vimeo.com/video/'
|
||||
) . $video['video'];
|
||||
@endphp
|
||||
|
||||
<div class="video-inlaid h-100" type="{{ $video['type_video'] }}"
|
||||
href="{{ $videoUrl }}">
|
||||
<div class="video-inlaid h-100" type="{{ $video['type_video'] }}" href="{{ $videoUrl }}">
|
||||
<a class="cn-cookie-link" id="youtube-warning" href="" rel="nofollow">
|
||||
<strong class="text-underline text-bold text-normal text-danger">
|
||||
{{ __('cookie-notice.custom.' . $video['type_video'] . '.warning') }}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
$getSection = fn($key) => $content[$key][0] ?? null;
|
||||
$getAnchor = fn($section) => Str::slug($section['string_title'] ?? '');
|
||||
$getConfig = fn($array, $value) => collect($array)->filter(fn($n) => $n['key'] === $value)->first();
|
||||
@endphp
|
||||
|
||||
{{-- COMMITMENTS LIST --}}
|
||||
|
|
|
|||
|
|
@ -4,106 +4,121 @@
|
|||
@section('description', $dynamicPageModel->content['list_identification'][0]['textarea_seo_description'])
|
||||
|
||||
@section('content')
|
||||
{{-- Section content blocs --}}
|
||||
@foreach($dynamicPageModel->content['list_section_engagement'] as $key => $sectionEngagement)
|
||||
@php
|
||||
$sections[$key] = [
|
||||
'bg' => $sectionEngagement['boolean_background_dark'],
|
||||
'title' => $sectionEngagement['string_title'],
|
||||
'subtitle' => [
|
||||
'text' => $sectionEngagement['string_subtitle'],
|
||||
],
|
||||
'list' => [],
|
||||
];
|
||||
foreach($sectionEngagement['list_block_content'] as $keyContent => $content) {
|
||||
$positionMedium = !is_null($content['list_media']) ? intval($content['list_media'][0]['position_medium']) : 0;
|
||||
array_push($sections[$key]['list'], [
|
||||
'title' => null,
|
||||
'text' => $content['wysiwyg_content'],
|
||||
'quote' => 0,
|
||||
'swap_position' => $positionMedium === \App\Enums\ElementPositionEnum::showbottom->value()
|
||||
? true
|
||||
: $positionMedium === \App\Enums\ElementPositionEnum::showright->value(),
|
||||
'in_row' => $positionMedium === \App\Enums\ElementPositionEnum::showbottom->value(),
|
||||
'floated' => !is_null($content['list_media']) ? intval($content['list_media'][0]['boolean_floated']) : 0,
|
||||
'align_center' => 0,
|
||||
'borders_desktop' => [
|
||||
'left' => true,
|
||||
'right' => true,
|
||||
'top' => true,
|
||||
'bottom' => true,
|
||||
],
|
||||
'borders_mobile' => [
|
||||
'left' => true,
|
||||
'right' => true,
|
||||
'top' => true,
|
||||
'bottom' => true,
|
||||
],
|
||||
'image' => [],
|
||||
'button_icon' => '',
|
||||
'button' => [],
|
||||
]);
|
||||
if (!is_null($content['list_media']) && $content['list_media'][0]['boolean_medium']) {
|
||||
foreach ($content['list_media'][0]['list_medium_type'] as $keyImg => $value) {
|
||||
$picture = array_values(array_filter([
|
||||
$value['image_picture'] ?? null,
|
||||
$value['file_gif'] ?? null,
|
||||
$value['vimeoid_video'] ?? null,
|
||||
$value['youtubeid_video'] ?? null,
|
||||
]))[0];
|
||||
array_push($sections[$key]['list'][$keyContent]['image'], [
|
||||
'url' => $picture ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
if (isset($content['list_button']) && $content['list_button'][0]['boolean_button']) {
|
||||
$sections[$key]['list'][$keyContent]['button'] = [
|
||||
'url' => $content['list_button'][0]['url_link'],
|
||||
'title' => $content['list_button'][0]['string_label'],
|
||||
'target' => '',
|
||||
];
|
||||
$sections[$key]['list'][$keyContent]['button_icon'] = $content['list_button'][0]['boolean_icon'] ? 'btn__icon_view' : 'btn__icon_arrow-right';
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
@endforeach
|
||||
@foreach ($sections as $section)
|
||||
<x-front.text-block :textBlock="$section" />
|
||||
@endforeach
|
||||
{{-- Sections numbers --}}
|
||||
@php $section = $dynamicPageModel->content['list_section_numbers'][0]; @endphp
|
||||
<div class="store-card fw fw-container">
|
||||
<div class="store-card__wrapper wrapper wrapper_small">
|
||||
<div class="our-commitment">
|
||||
{{-- Section content blocs --}}
|
||||
@foreach($dynamicPageModel->content['list_section_engagement'] as $key => $sectionEngagement)
|
||||
@php
|
||||
$brands = [];
|
||||
if (
|
||||
isset($pageNosMarques)
|
||||
&& isset($pageNosMarques->content['list_our_big_brands'])
|
||||
&& isset($pageNosMarques->content['list_our_big_brands'][0]['list_brands'])
|
||||
) {
|
||||
foreach ($pageNosMarques->content['list_our_big_brands'][0]['list_brands'] as $key => $logo) {
|
||||
array_push($brands, [
|
||||
'image' => [
|
||||
'url' => asset($logo['list_logo'][0]['image_brand_logo']),
|
||||
],
|
||||
]);
|
||||
$sections[$key] = [
|
||||
'bg' => $sectionEngagement['boolean_background_dark'],
|
||||
'title' => $sectionEngagement['string_title'],
|
||||
'subtitle' => [
|
||||
'text' => $sectionEngagement['string_subtitle'],
|
||||
],
|
||||
'list' => [],
|
||||
];
|
||||
$getConfig = fn($array, $value) => collect($array)->filter(fn($n) => $n['key'] === $value)->first();
|
||||
|
||||
foreach($sectionEngagement['list_block_content'] as $keyContent => $content) {
|
||||
$positionMedium = !is_null($content['list_media']) ? intval($content['list_media'][0]['position_medium']) : 0;
|
||||
array_push($sections[$key]['list'], [
|
||||
'title' => $content['string_title'] ?? null,
|
||||
'text' => $content['wysiwyg_content'],
|
||||
'quote' => 0,
|
||||
'swap_position' => $positionMedium === \App\Enums\ElementPositionEnum::showbottom->value()
|
||||
? true
|
||||
: $positionMedium === \App\Enums\ElementPositionEnum::showright->value(),
|
||||
'in_row' => $positionMedium === \App\Enums\ElementPositionEnum::showbottom->value(),
|
||||
'floated' => !is_null($content['list_media']) ? intval($content['list_media'][0]['boolean_floated']) : 0,
|
||||
'align_center' => 1,
|
||||
'borders_desktop' => [
|
||||
'left' => true,
|
||||
'right' => true,
|
||||
'top' => true,
|
||||
'bottom' => true,
|
||||
],
|
||||
'borders_mobile' => [
|
||||
'left' => true,
|
||||
'right' => true,
|
||||
'top' => true,
|
||||
'bottom' => true,
|
||||
],
|
||||
'image' => [],
|
||||
'video' => [],
|
||||
'button_icon' => '',
|
||||
'button' => [],
|
||||
]);
|
||||
if (!is_null($content['list_media']) && $content['list_media'][0]['boolean_medium']) {
|
||||
foreach ($content['list_media'][0]['list_medium_type'] as $keyImg => $value) {
|
||||
unset($value['order']);
|
||||
$filtered = array_filter($value);
|
||||
$field = array_key_first($filtered);
|
||||
$aaa = $getConfig($dynamicPageModel->config->config, 'list_section_engagement');
|
||||
$bbb = $getConfig($aaa['children'], 'list_block_content');
|
||||
$ccc = $getConfig($bbb['children'], 'list_media');
|
||||
$ddd = $getConfig($ccc['children'], 'list_medium_type');
|
||||
$eee = $getConfig($ddd['children'], $field);
|
||||
|
||||
if ($eee['type'] === \App\Enums\DynamicFieldTypes::youtubeid->value()) {
|
||||
$sections[$key]['list'][$keyContent]['video'] = [
|
||||
'type_video' => 'youtube',
|
||||
'video' => $filtered[$field],
|
||||
];
|
||||
} else {
|
||||
array_push($sections[$key]['list'][$keyContent]['image'], [
|
||||
'url' => $filtered[$field] ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($content['list_button']) && $content['list_button'][0]['boolean_button']) {
|
||||
$sections[$key]['list'][$keyContent]['button'] = [
|
||||
'url' => $content['list_button'][0]['url_link'],
|
||||
'title' => $content['list_button'][0]['string_label'],
|
||||
'target' => '',
|
||||
];
|
||||
$sections[$key]['list'][$keyContent]['button_icon'] = $content['list_button'][0]['boolean_icon'] ? 'btn__icon_view' : 'btn__icon_arrow-right';
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
@if(!empty($brands))
|
||||
<x-front.brands-icons.brands-icons :brands="$brands" :title="$section['string_title']" :subtitle="$section['string_subtitle']"
|
||||
:isOnCommitmentPage="true" />
|
||||
@else
|
||||
<x-front.sections.title :title="$section['string_title']" :subtitle="$section['string_subtitle']" />
|
||||
@endif
|
||||
<x-front.commitments.score-card :cards="$section['list_card']" />
|
||||
</div>
|
||||
</div>
|
||||
@if($pageNosEngagements->childPages->count())
|
||||
<div class="engagements fw fw-container">
|
||||
<div class="engagements__wrapper wrapper">
|
||||
<x-front.commitments.list />
|
||||
@endforeach
|
||||
@foreach ($sections as $section)
|
||||
<x-front.text-block :textBlock="$section" />
|
||||
@endforeach
|
||||
{{-- Sections numbers --}}
|
||||
@php $section = $dynamicPageModel->content['list_section_numbers'][0]; @endphp
|
||||
<div class="store-card fw fw-container">
|
||||
<div class="store-card__wrapper wrapper wrapper_small">
|
||||
@php
|
||||
$brands = [];
|
||||
if (
|
||||
isset($pageNosMarques)
|
||||
&& isset($pageNosMarques->content['list_our_big_brands'])
|
||||
&& isset($pageNosMarques->content['list_our_big_brands'][0]['list_brands'])
|
||||
) {
|
||||
foreach ($pageNosMarques->content['list_our_big_brands'][0]['list_brands'] as $key => $logo) {
|
||||
array_push($brands, [
|
||||
'image' => [
|
||||
'url' => asset($logo['list_logo'][0]['image_brand_logo']),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
@if(!empty($brands))
|
||||
<x-front.brands-icons.brands-icons :brands="$brands" :title="$section['string_title']" :subtitle="$section['string_subtitle']"
|
||||
:isOnCommitmentPage="true" />
|
||||
@else
|
||||
<x-front.sections.title :title="$section['string_title']" :subtitle="$section['string_subtitle']" />
|
||||
@endif
|
||||
<x-front.commitments.score-card :cards="$section['list_card']" />
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if($pageNosEngagements->childPages->count())
|
||||
<div class="engagements fw fw-container">
|
||||
<div class="engagements__wrapper wrapper">
|
||||
<x-front.commitments.list />
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endsection
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue