From 1de77bfadc3eaa18806157a59e81f22b0c842b97 Mon Sep 17 00:00:00 2001 From: SofianeLasri <alasri250@gmail.com> Date: Thu, 20 Feb 2025 12:22:27 +0100 Subject: [PATCH 1/3] feat: Add Terms and Conditions page - Created a new TermsController to handle the display of active terms. - Added a terms view with a markdown component for displaying content. - Updated the generic page header component to allow empty descriptions. - Modified the footer to include a link to the Terms and Conditions page. - Added a new route for the Terms and Conditions page. --- .../Controllers/Public/TermsController.php | 22 +++++++++++++++++++ .../views/components/public/footer.blade.php | 6 ++--- .../public/generic-page-header.blade.php | 2 +- resources/views/public/terms.blade.php | 16 ++++++++++++++ routes/web.php | 2 ++ 5 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 app/Http/Controllers/Public/TermsController.php create mode 100644 resources/views/public/terms.blade.php diff --git a/app/Http/Controllers/Public/TermsController.php b/app/Http/Controllers/Public/TermsController.php new file mode 100644 index 0000000..a20736b --- /dev/null +++ b/app/Http/Controllers/Public/TermsController.php @@ -0,0 +1,22 @@ +<?php + +namespace App\Http\Controllers\Public; + +use App\Http\Controllers\Controller; +use App\Models\TermsSection; +use Illuminate\View\View; + +class TermsController extends Controller +{ + public function __invoke(): View + { + $activeTermsText = TermsSection::where('active', true)->first(); + + if (! $activeTermsText) { + abort(404); + } + $activeTermsText = $activeTermsText->contentTranslationKey->getTranslation(); + + return view('public.terms', compact('activeTermsText')); + } +} diff --git a/resources/views/components/public/footer.blade.php b/resources/views/components/public/footer.blade.php index 05142fd..82765bb 100644 --- a/resources/views/components/public/footer.blade.php +++ b/resources/views/components/public/footer.blade.php @@ -36,14 +36,12 @@ <div class="self-stretch text-2xl font-bold">Informations légales</div> <ul class="flex flex-col gap-2"> <li> - <a href="#" class="text-muted hover:text-primary">Mentions légales</a> + <a href="{{ route('legal-mentions') }}" class="text-muted hover:text-primary">Mentions + légales</a> </li> <li> <a href="#" class="text-muted hover:text-primary">Conditions générales de vente</a> </li> - <li> - <a href="#" class="text-muted hover:text-primary">Politique de confidentialité</a> - </li> </ul> </div> </div> diff --git a/resources/views/components/public/generic-page-header.blade.php b/resources/views/components/public/generic-page-header.blade.php index 7883746..defaac7 100644 --- a/resources/views/components/public/generic-page-header.blade.php +++ b/resources/views/components/public/generic-page-header.blade.php @@ -1,6 +1,6 @@ @props([ 'title' => 'Title', - 'description' => 'Description', + 'description' => '', ]) <div {{ $attributes->class(['relative flex flex-col max-w-2xl gap-3']) }}> diff --git a/resources/views/public/terms.blade.php b/resources/views/public/terms.blade.php new file mode 100644 index 0000000..65b7b67 --- /dev/null +++ b/resources/views/public/terms.blade.php @@ -0,0 +1,16 @@ +@extends('layouts.public', ['title' => "Mentions légales"]) + +@section('content') + <x-public.navbar class="container mx-auto px-4"/> + + <div class="container mx-auto px-4 py-24 flex flex-col gap-16"> + <x-public.generic-page-header title="Mentions légales"/> + <div class=""> + <x-markdown class="markdown"> + {{ $activeTermsText }} + </x-markdown> + </div> + </div> + + <x-public.footer/> +@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index aa637dc..d92fdd4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -13,6 +13,7 @@ use App\Http\Controllers\Public\IndexController; use App\Http\Controllers\Public\PortfolioController; use App\Http\Controllers\Public\PrestationController as PublicPrestationController; +use App\Http\Controllers\Public\TermsController; use App\Http\Middleware\CheckPrivateModeMiddleware; use App\Http\Middleware\RedirectIfUserExistsMiddleware; use Illuminate\Support\Facades\Route; @@ -29,6 +30,7 @@ Route::get('/portfolio/api', [PortfolioController::class, 'api'])->name('portfolio.api'); Route::get('/portfolio/{slug}', [PortfolioController::class, 'show'])->name('portfolio.show'); Route::get('/prestations/{slug}', [PublicPrestationController::class, 'index'])->name('prestations.show'); + Route::get('/mentions-legales', TermsController::class)->name('legal-mentions'); Route::view('/maintenance', 'public.maintenance')->name('maintenance'); }); -- GitLab From f25cb186b76a6deed16b01cda624bff57ee48450 Mon Sep 17 00:00:00 2001 From: SofianeLasri <alasri250@gmail.com> Date: Thu, 20 Feb 2025 13:45:53 +0100 Subject: [PATCH 2/3] feat: add legal mentions page and update terms page with localization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Created a new LegalMentionsController to handle the display of legal mentions. - Added a new Blade view for legal mentions with localization support. - Updated the terms page to use localized titles. - Updated footer links to use localized text for legal mentions and terms. - Added French localization entries for "Mentions légales" and "Conditions générales de vente". --- .../Public/LegalMentionsController.php | 21 +++++++++++++++++++ lang/fr/generic.php | 2 ++ .../views/components/public/footer.blade.php | 7 ++++--- .../views/public/legal-mentions.blade.php | 16 ++++++++++++++ resources/views/public/terms.blade.php | 6 +++--- routes/web.php | 4 +++- 6 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 app/Http/Controllers/Public/LegalMentionsController.php create mode 100644 resources/views/public/legal-mentions.blade.php diff --git a/app/Http/Controllers/Public/LegalMentionsController.php b/app/Http/Controllers/Public/LegalMentionsController.php new file mode 100644 index 0000000..4098697 --- /dev/null +++ b/app/Http/Controllers/Public/LegalMentionsController.php @@ -0,0 +1,21 @@ +<?php + +namespace App\Http\Controllers\Public; + +use App\Http\Controllers\Controller; +use App\Models\LegalMention; + +class LegalMentionsController extends Controller +{ + public function __invoke() + { + $activeLegalMentionsText = LegalMention::where('active', true)->first(); + + if (! $activeLegalMentionsText) { + abort(404); + } + $activeLegalMentionsText = $activeLegalMentionsText->contentTransKey->getTranslation(); + + return view('public.legal-mentions', compact('activeLegalMentionsText')); + } +} diff --git a/lang/fr/generic.php b/lang/fr/generic.php index 4b27032..0c36935 100644 --- a/lang/fr/generic.php +++ b/lang/fr/generic.php @@ -4,4 +4,6 @@ 'custom_needs' => 'Un besoin particulier ?', 'custom_needs_desc' => 'Je suis ouverte à toute proposition. N’hésitez pas à me contacter !', 'completed_in' => 'Réalisé en', + 'legal_mentions' => 'Mentions légales', + 'terms' => 'Conditions générales de vente', ]; diff --git a/resources/views/components/public/footer.blade.php b/resources/views/components/public/footer.blade.php index 82765bb..720ebc3 100644 --- a/resources/views/components/public/footer.blade.php +++ b/resources/views/components/public/footer.blade.php @@ -36,11 +36,12 @@ <div class="self-stretch text-2xl font-bold">Informations légales</div> <ul class="flex flex-col gap-2"> <li> - <a href="{{ route('legal-mentions') }}" class="text-muted hover:text-primary">Mentions - légales</a> + <a href="{{ route('legal-mentions') }}" + class="text-muted hover:text-primary">{{ __('generic.legal_mentions') }}</a> </li> <li> - <a href="#" class="text-muted hover:text-primary">Conditions générales de vente</a> + <a href="{{ route('terms') }}" + class="text-muted hover:text-primary">{{ __('generic.terms') }}</a> </li> </ul> </div> diff --git a/resources/views/public/legal-mentions.blade.php b/resources/views/public/legal-mentions.blade.php new file mode 100644 index 0000000..65d3c5c --- /dev/null +++ b/resources/views/public/legal-mentions.blade.php @@ -0,0 +1,16 @@ +@extends('layouts.public', ['title' => __('generic.legal_mentions')]) + +@section('content') + <x-public.navbar class="container mx-auto px-4"/> + + <div class="container mx-auto px-4 py-24 flex flex-col gap-16"> + <x-public.generic-page-header title="{{ __('generic.legal_mentions') }}"/> + <div> + <x-markdown class="markdown"> + {{ $activeLegalMentionsText }} + </x-markdown> + </div> + </div> + + <x-public.footer/> +@endsection \ No newline at end of file diff --git a/resources/views/public/terms.blade.php b/resources/views/public/terms.blade.php index 65b7b67..c7d919a 100644 --- a/resources/views/public/terms.blade.php +++ b/resources/views/public/terms.blade.php @@ -1,11 +1,11 @@ -@extends('layouts.public', ['title' => "Mentions légales"]) +@extends('layouts.public', ['title' => __('generic.terms')]) @section('content') <x-public.navbar class="container mx-auto px-4"/> <div class="container mx-auto px-4 py-24 flex flex-col gap-16"> - <x-public.generic-page-header title="Mentions légales"/> - <div class=""> + <x-public.generic-page-header title="{{ __('generic.terms') }}"/> + <div> <x-markdown class="markdown"> {{ $activeTermsText }} </x-markdown> diff --git a/routes/web.php b/routes/web.php index d92fdd4..3f72ca5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -11,6 +11,7 @@ use App\Http\Controllers\Admin\SocialMediaLinksController; use App\Http\Controllers\Admin\TermsSectionController; use App\Http\Controllers\Public\IndexController; +use App\Http\Controllers\Public\LegalMentionsController; use App\Http\Controllers\Public\PortfolioController; use App\Http\Controllers\Public\PrestationController as PublicPrestationController; use App\Http\Controllers\Public\TermsController; @@ -30,7 +31,8 @@ Route::get('/portfolio/api', [PortfolioController::class, 'api'])->name('portfolio.api'); Route::get('/portfolio/{slug}', [PortfolioController::class, 'show'])->name('portfolio.show'); Route::get('/prestations/{slug}', [PublicPrestationController::class, 'index'])->name('prestations.show'); - Route::get('/mentions-legales', TermsController::class)->name('legal-mentions'); + Route::get('/mentions-legales', LegalMentionsController::class)->name('legal-mentions'); + Route::get('/conditions-generales-de-vente', TermsController::class)->name('terms'); Route::view('/maintenance', 'public.maintenance')->name('maintenance'); }); -- GitLab From 509cd958b901483878bbfd9fd565c2993580cfc1 Mon Sep 17 00:00:00 2001 From: SofianeLasri <alasri250@gmail.com> Date: Thu, 20 Feb 2025 13:53:21 +0100 Subject: [PATCH 3/3] feat(footer): add legal information and contact details in English and French - Added 'legal_mentions' and 'terms' to the English language file. - Created new footer language files for English and French containing contact information and legal details. - Updated the footer Blade template to utilize the new language strings for better localization. --- lang/en/footer.php | 14 ++++++++++++++ lang/en/generic.php | 2 ++ lang/fr/footer.php | 14 ++++++++++++++ resources/views/components/public/footer.blade.php | 12 ++++++------ 4 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 lang/en/footer.php create mode 100644 lang/fr/footer.php diff --git a/lang/en/footer.php b/lang/en/footer.php new file mode 100644 index 0000000..8c46e83 --- /dev/null +++ b/lang/en/footer.php @@ -0,0 +1,14 @@ +<?php + +return [ + 'contact' => [ + 'title' => 'Excited to work with you!', + 'desc' => 'Feel free to contact me if you need information, or if you just want to chat with me.', + ], + 'links' => [ + 'title' => 'Stay in touch', + ], + 'legals-infos' => [ + 'title' => 'Legal information', + ], +]; diff --git a/lang/en/generic.php b/lang/en/generic.php index 51de6fe..a345a84 100644 --- a/lang/en/generic.php +++ b/lang/en/generic.php @@ -4,4 +4,6 @@ 'custom_needs' => 'A specific need?', 'custom_needs_desc' => 'I am open to any proposal. Don’t hesitate to contact me!', 'completed_in' => 'Completed in', + 'legal_mentions' => 'Legal notices', + 'terms' => 'Terms and conditions of sale', ]; diff --git a/lang/fr/footer.php b/lang/fr/footer.php new file mode 100644 index 0000000..0e7acde --- /dev/null +++ b/lang/fr/footer.php @@ -0,0 +1,14 @@ +<?php + +return [ + 'contact' => [ + 'title' => 'Hâte de travailler avec vous !', + 'desc' => 'N’hésitez pas à me contacter si vous avez besoin de renseignements, ou que vous souhaitez simplement discuter avec moi.', + ], + 'links' => [ + 'title' => 'Restons en contact', + ], + 'legals-infos' => [ + 'title' => 'Informations légales', + ], +]; diff --git a/resources/views/components/public/footer.blade.php b/resources/views/components/public/footer.blade.php index 720ebc3..b49d55e 100644 --- a/resources/views/components/public/footer.blade.php +++ b/resources/views/components/public/footer.blade.php @@ -8,20 +8,20 @@ <x-public.rann-logo height="4rem" role="image"/> </div> <div class="self-stretch flex-col justify-start items-start gap-2 flex"> - <div class="self-stretch text-2xl font-bold">Hâte de travailler avec vous !</div> - <div class="self-stretch text-muted">N’hésitez pas à me contacter si vous avez besoin de - renseignements, ou que vous souhaitez simplement discuter avec moi. + <div class="self-stretch text-2xl font-bold">{{ __('footer.contact.title') }}</div> + <div class="self-stretch text-muted"> + {{ __('footer.contact.desc') }} </div> </div> <x-public.button size="medium" tag="a" href="#"> - <div class="text-xl font-bold">Me contacter</div> + <div class="text-xl font-bold">{{ __('navbar.contact_me') }}</div> </x-public.button> </div> </div> <div class="w-full lg:w-auto items-start flex flex-col lg:flex-row gap-8 lg:gap-24"> <div class="w-full lg:w-56 flex-col gap-8 flex"> - <div class="self-stretch text-2xl font-bold">Restons en contact</div> + <div class="self-stretch text-2xl font-bold">{{ __('footer.links.title') }}</div> <ul class="flex flex-col gap-2"> @foreach(\App\Models\SocialMediaLink::all() as $socialMediaLink) <li> @@ -33,7 +33,7 @@ </ul> </div> <div class="w-full lg:w-56 flex-col gap-8 flex"> - <div class="self-stretch text-2xl font-bold">Informations légales</div> + <div class="self-stretch text-2xl font-bold">{{ __('footer.legals-infos.title') }}</div> <ul class="flex flex-col gap-2"> <li> <a href="{{ route('legal-mentions') }}" -- GitLab