Merge branch 'develop' into trunk
This commit is contained in:
commit
f7cfdc6dac
13 changed files with 133 additions and 14 deletions
|
|
@ -60,6 +60,13 @@ class Handler extends ExceptionHandler
|
|||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
if ($e instanceof \Illuminate\Validation\ValidationException && $request->ajax()) {
|
||||
return response()->json([
|
||||
'message' => $e->getMessage(),
|
||||
'errors' => $e->errors(),
|
||||
], $e->status);
|
||||
}
|
||||
|
||||
$status = method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 500;
|
||||
|
||||
return response()->json([
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\StaticPageType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
/**
|
||||
* SectionPage
|
||||
|
|
@ -64,4 +66,20 @@ class SectionPage extends Model
|
|||
{
|
||||
return $this->hasMany(Picto::class, 'section_id')->orderBy('order');
|
||||
}
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::saving(function ($section) {
|
||||
|
||||
if (
|
||||
$section->page->type === StaticPageType::raiseSustainably
|
||||
&& $section->name === 'section 3'
|
||||
&& !str_contains($section->data->title->value, ':nbrKeyList')
|
||||
) {
|
||||
throw ValidationException::withMessages([
|
||||
'data.title.value' => __('validation.custom.data_title_value.contains_placeholder'),
|
||||
]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\StaticPageType;
|
||||
use App\Models\StaticPage;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$staticPage = StaticPage::query()
|
||||
->where('type', StaticPageType::forLivingTogether)
|
||||
->with(['sections.blocks', 'sections.pictos', 'sections.page'])
|
||||
->first();
|
||||
if ($staticPage) {
|
||||
foreach ($staticPage->sections as $section) {
|
||||
if ($section->name === 'section 3' && isset($section->data->title)) {
|
||||
$data = $section->data;
|
||||
unset($data->title);
|
||||
$section->data = $data;
|
||||
$section->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$staticPage = StaticPage::query()
|
||||
->where('type', StaticPageType::forLivingTogether)
|
||||
->with(['sections.blocks', 'sections.pictos', 'sections.page'])
|
||||
->first();
|
||||
|
||||
if ($staticPage) {
|
||||
foreach ($staticPage->sections as $section) {
|
||||
if ($section->name === 'section 3') {
|
||||
$oldData = $section->data;
|
||||
|
||||
$title = new \stdClass();
|
||||
$title->label = 'Section 3 : Titre';
|
||||
$title->inputType = 11;
|
||||
$title->value = 'le gaulois, partenaire majeur de clubs sportifs emblématiques de la région : MSB ainsi que de 30 associations locales';
|
||||
$title->validate = 'required|string|between:3,255';
|
||||
$title->required = true;
|
||||
|
||||
$newData = new \stdClass();
|
||||
$newData->title = $title;
|
||||
|
||||
foreach ($oldData as $key => $value) {
|
||||
$newData->{$key} = $value;
|
||||
}
|
||||
$section->data = $newData;
|
||||
$section->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -335,6 +335,9 @@ return [
|
|||
'picture_title' => 'image title',
|
||||
'video_alt' => 'video alternative text',
|
||||
'video_title' => 'video title',
|
||||
'section' => 'section|sections'
|
||||
'section' => 'section|sections',
|
||||
'data_title_value' => [
|
||||
'contains_placeholder' => 'The title field must contain the :nbrKeyList placeholder.',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -354,6 +354,9 @@ return [
|
|||
'picture_title' => 'titre de l\'image',
|
||||
'video_alt' => 'texte alternatif de la vidéo',
|
||||
'video_title' => 'titre de la vidéo',
|
||||
'section' => 'section|sections'
|
||||
'section' => 'section|sections',
|
||||
'data_title_value' => [
|
||||
'contains_placeholder' => 'Le champ titre doit contenir :nbrKeyList pour le calcule automatique des points.',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -116,7 +116,9 @@
|
|||
])
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-6" id="{{ $idPrefix }}-pictureSizeBlock"
|
||||
@if (str($pictoModel?->picture ?? '')->endsWith('.svg')) style="display:none;" @endif
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-4">
|
||||
@include('bo.partials.inputs.int-number', [
|
||||
|
|
@ -143,12 +145,13 @@
|
|||
data-target-image="{{ $idPrefix }}-pictoPicture"
|
||||
data-width-input="{{ $idPrefix }}-pictoWidth"
|
||||
data-height-input="{{ $idPrefix }}-pictoHeight" data-bs-toggle="tooltip"
|
||||
data-picto-id="{{ $pictoModel?->id }}"
|
||||
type="button" title="{{ __('save size') }}">
|
||||
data-picto-id="{{ $pictoModel?->id }}" type="button"
|
||||
title="{{ __('save size') }}">
|
||||
{{ str(__('sauvegarder taille'))->ucfirst() }}
|
||||
</button>
|
||||
</div>
|
||||
<small class="form-text text-body-secondary">{{__('crud.minicrud.update_size_picture_helper')}}</small>
|
||||
<small
|
||||
class="form-text text-body-secondary">{{ __('crud.minicrud.update_size_picture_helper') }}</small>
|
||||
</div>
|
||||
</div>
|
||||
{{-- PICTURE --}}
|
||||
|
|
|
|||
|
|
@ -205,13 +205,13 @@
|
|||
'picto' => asset($section_8->media_picto->value),
|
||||
'picto_alt' => __($section_8->media_picto->alt),
|
||||
'picto_title' => __($section_8->media_picto->title),
|
||||
'reduction' => $reduction_8,
|
||||
'reversedMobile' => true,
|
||||
])
|
||||
{{-- HGROUP LIST --}}
|
||||
@include('fo.partials.commitments.hgroup-list', [
|
||||
'number' => $commitmentId,
|
||||
'text' => nl2br(__($section_8->description_beige->value)),
|
||||
'reduction' => $reduction_8,
|
||||
])
|
||||
@endif
|
||||
{{-- PARAGRAPH WITH PICTURE --}}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@
|
|||
@if ($section_3_model->visibility)
|
||||
@include('fo.partials.commitments.banner-text-complex-items', [
|
||||
'number' => $commitmentId,
|
||||
'title' => __($section_3->title->value),
|
||||
'encart_text' => $section_3->title_sec->value,
|
||||
'text' => nl2br($section_3->description->value),
|
||||
'picto' => $section_3->media_picto->value,
|
||||
|
|
|
|||
|
|
@ -120,7 +120,6 @@
|
|||
'picto_alt' => __($section_4->media_picto->alt),
|
||||
'picto_title' => __($section_4->media_picto->title),
|
||||
'reduction' => $reduction_4,
|
||||
'btnLabel' => str(__('découvrir la démarche'))->upper(),
|
||||
'btnLink' => route('fo.breeding.oui-c-est-bon'),
|
||||
'reversed' => true,
|
||||
])
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<div class="position-relative z-2 w-100 container h-fit">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
<h2 class="banner-title">{{ $title }}</h2>
|
||||
<h2 class="banner-title">{{ $title ?? null }}</h2>
|
||||
</div>
|
||||
<div class="text-custom-placement col-12 col-md-6">
|
||||
@if (isset($picto) && !empty($picto))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,26 @@
|
|||
@php
|
||||
$reduction ??= null;
|
||||
$blockType = $reduction?->block_type->value;
|
||||
$position = $reduction?->position->value;
|
||||
$ctaUrl = $reduction?->cta_url->value ?? null;
|
||||
$ctaLabel = $reduction?->cta_label->value ?? null;
|
||||
$articleId = $reduction?->article_id->value ?? null;
|
||||
$reductionNews = $articleId ? \App\Models\News::find($articleId) : null;
|
||||
$visibility = $reduction?->visibility->value ?? false;
|
||||
@endphp
|
||||
<section id="commitments-hgroup-list" class="container position-relative mb-5 ck-editor">
|
||||
<div class="bg-tertiary p-4">
|
||||
{!! clean($text) !!}
|
||||
</div>
|
||||
@if ($visibility)
|
||||
<div class="container mt-4">
|
||||
@include('fo.partials.block.reduction-card', [
|
||||
'news' => $reductionNews,
|
||||
'ctaUrl' => $ctaUrl ?? null,
|
||||
'ctaLabel' => $ctaLabel ?? null,
|
||||
'position' => $position,
|
||||
'blockType' => $blockType,
|
||||
])
|
||||
</div>
|
||||
@endif
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<section id="commitments-keys-list" class="line-border-large bg-light py-5">
|
||||
<div class="container">
|
||||
<div class="row justify-content-between">
|
||||
<div class="row g-2">
|
||||
<div class="card-wrapper position-relative col-12 col-lg-4 p-3">
|
||||
<div class="d-flex justify-content-start align-items-center h-100">
|
||||
<h4 class="text-start m-0">
|
||||
|
|
|
|||
|
|
@ -113,16 +113,16 @@
|
|||
$ctaLabel = $reduction->cta_label->value ?? null;
|
||||
$articleId = $reduction->article_id->value ?? null;
|
||||
$reductionNews = $articleId ? \App\Models\News::find($articleId) : null;
|
||||
$visibility = $reduction->visibility->value ?? true;
|
||||
$visibility = $reduction?->visibility->value ?? false;
|
||||
@endphp
|
||||
@if ($visibility)
|
||||
@include('fo.partials.block.reduction-card', [
|
||||
@include('fo.partials.block.reduction-card', [
|
||||
'news' => $reductionNews,
|
||||
'ctaUrl' => $ctaUrl ?? null,
|
||||
'ctaLabel' => $ctaLabel ?? null,
|
||||
'position' => $position,
|
||||
'blockType' => $blockType,
|
||||
])
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue