Merge branch 'update-lang-switch-redirection' into 'develop'

Lang switchs now redirect to the same page with the selected lang

See merge request ldc-web/projets/nature-and-respect!29
This commit is contained in:
Vincent BRIDIER 2023-09-06 10:18:25 +00:00
commit 62571fcec6
7 changed files with 14 additions and 11 deletions

View file

@ -39,7 +39,7 @@ class SecureHeaders
$jsDev = config('app.debug') ? "'unsafe-eval' 'unsafe-inline'" : "'nonce-{$nonce}' 'strict-dynamic'";
$scheme = config('app.env') === 'local' ? 'http' : 'https';
$reportUri = Route::has('cspReportUri') ?
\sprintf(' report-uri %s ;', \parse_url(route('cspReportUri'), \PHP_URL_PATH)) : '';
\sprintf(' report-uri %s ;', \parse_url(route('cspReportUri'), \PHP_URL_PATH)) : '';
$this->removeUnwantedHeaders($this->unwantedHeaderList);
$response = $next($request);
$response->headers->set('Referrer-Policy', 'no-referrer-when-downgrade');
@ -84,7 +84,9 @@ class SecureHeaders
]) . ';',
// ! If you dont use ckeditor use this
// "style-src 'self' 'nonce-$nonce';",
// phpcs:disable Generic.Commenting.Fixme.TaskFound
// FIXME: use Alpine CSP compliant.
// phpcs:enable
// ! unsave Eval needed for Alpine JS de merde.
// phpcs:ignore Generic.Files.LineLength.TooLong
"script-src 'self' 'unsafe-eval' {$jsDev} " . \implode(' ', [

View file

@ -32,6 +32,7 @@ abstract class UpdateMiniCrudRequest extends FormRequest
* Get the validation rules that apply to the request.
*
* @return array
* @phpcs:disable Generic.Metrics.CyclomaticComplexity.MaxExceeded
* @phpcs:disable Generic.Metrics.NestingLevel.TooHigh
* @phpcs:disable Generic.Metrics.CyclomaticComplexity.MaxExceeded
*/

12
composer.lock generated
View file

@ -311,16 +311,16 @@
},
{
"name": "codezero/laravel-localized-routes",
"version": "3.1.3",
"version": "3.1.5",
"source": {
"type": "git",
"url": "https://github.com/codezero-be/laravel-localized-routes.git",
"reference": "fac6e4a7bb32e2c42bb7aca53d3336d450ab3cba"
"reference": "0ebb3acd58b4b635ec9d6d20de9a1770da0c9ced"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/codezero-be/laravel-localized-routes/zipball/fac6e4a7bb32e2c42bb7aca53d3336d450ab3cba",
"reference": "fac6e4a7bb32e2c42bb7aca53d3336d450ab3cba",
"url": "https://api.github.com/repos/codezero-be/laravel-localized-routes/zipball/0ebb3acd58b4b635ec9d6d20de9a1770da0c9ced",
"reference": "0ebb3acd58b4b635ec9d6d20de9a1770da0c9ced",
"shasum": ""
},
"require": {
@ -379,7 +379,7 @@
],
"support": {
"issues": "https://github.com/codezero-be/laravel-localized-routes/issues",
"source": "https://github.com/codezero-be/laravel-localized-routes/tree/3.1.3"
"source": "https://github.com/codezero-be/laravel-localized-routes/tree/3.1.5"
},
"funding": [
{
@ -391,7 +391,7 @@
"type": "ko_fi"
}
],
"time": "2023-05-02T10:47:12+00:00"
"time": "2023-06-01T20:21:52+00:00"
},
{
"name": "codezero/laravel-unique-translation",

View file

@ -19,7 +19,7 @@
<ul class="xinvisible xgroup-hover:visible pl-8 lg:pl-0 lg:absolute lg:left-0 lg:right-auto w-max pt-2">
@foreach (config('app.locales') as $locale)
<li class="mt-2">
<a href="{{ route('home', [], true, $locale) }}">
<a href="{{ Route::localizedUrl($locale) }}">
<img src="{{ Vite::asset('resources/assets/images/Icons/flag-' . $locale . '.svg') }}" alt="{{ __('Flag for the :locale language', ['locale' => $locale]) }}" class="w-8">
</a>
</li>

View file

@ -18,7 +18,7 @@
@if (!$loop->first)
|
@endif
<a href="{{ route('home', [], true, $locale) }}" class="@if (app()->currentLocale() === $locale) text-hellgruen @endif">{{ Str::upper($locale) }}</a>
<a href="{{ Route::localizedUrl($locale) }}" class="@if (app()->currentLocale() === $locale) text-hellgruen @endif">{{ Str::upper($locale) }}</a>
@endforeach
</div>
</nav>

View file

@ -59,7 +59,7 @@
@if (!$loop->first)
|
@endif
<a href="{{ route('home', [], true, $locale) }}" class="@if (app()->currentLocale() === $locale) text-hellgruen @endif">{{ Str::upper($locale) }}</a>
<a href="{{ Route::localizedUrl($locale) }}" class="@if (app()->currentLocale() === $locale) text-hellgruen @endif">{{ Str::upper($locale) }}</a>
@endforeach
</div>

View file

@ -119,7 +119,7 @@ Route::prefix('bo')
->withoutMiddleware('htmlsanitize')
->middleware(['htmlsanitize:description']);
Route::post('/sliders/{slider}/change-order', [SliderController::class, 'changeOrder'])
->name('sliders.change-order');
->name('sliders.change-order');
});
}
);