Merge branch 'trunk'

This commit is contained in:
Vincent BRIDIER 2022-11-16 09:22:08 +01:00
commit 1028507a53
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
4 changed files with 53 additions and 35 deletions

View file

@ -1,11 +1,11 @@
image: $CI_REGISTRY/service-web-lab/ldc-web-images-docker/ldcweb-qa:php7.3-1.0
stages:
- Security
- CodingStandards
- Builds
composer-security:
stage: Security
image: $CI_REGISTRY/service-web-lab/ldc-web-images-docker/ldcweb-qa:php7.3-1.0
script:
- local-php-security-checker --format=json --path=./composer.lock > composer-security-checker-report.json
artifacts:
@ -14,9 +14,13 @@ composer-security:
paths:
- composer-security-checker-report.json
allow_failure: true
needs: []
npm-security:
stage: Security
image: node:17.9.1
before_script:
- npm install --location=global audit-ci@^6
script:
- audit-ci -p npm -o json > npm-security-checker-report.json
artifacts:
@ -25,9 +29,11 @@ npm-security:
paths:
- npm-security-checker-report.json
allow_failure: true
needs: []
phpcs:
stage: CodingStandards
image: $CI_REGISTRY/service-web-lab/ldc-web-images-docker/ldcweb-qa:php7.3-1.0
before_script:
- composer config gitlab-token.gitlab.com $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD
- composer install
@ -44,3 +50,25 @@ phpcs:
reports:
junit: phpcs-report.xml
allow_failure: false
needs:
- composer-security
- npm-security
front-build:
stage: Builds
image: node:17.9.1
before_script:
- npm install
cache:
paths:
- node_modules/
script:
- npm run prod > front-build-report.json
artifacts:
when: on_failure
expose_as: 'front-build-report'
paths:
- front-build-report.json
allow_failure: false
needs:
- phpcs

View file

@ -35,34 +35,28 @@ class LangCheck
}
} else {
// FRONT.
// phpcs:disable
$langset = 'fr';
$this->saveUserLocale($langset, $request);
// TODO : Reactivate below when activating langs
// if (preg_match('/^(' . \implode("|", config('app.other_locales')) . ')\./', $routName)) {
// // From front use named routes.
// $langset = $request->segment(1);
if (preg_match('/^(' . \implode("|", config('app.other_locales')) . ')\./', $routName)) {
// From front use named routes.
$langset = $request->segment(1);
$this->saveUserLocale($langset, $request);
} else {
// Not specified in route.
if ($this->checkFirstAccess($request)) {
$routNameEN = 'en.' . $routName;
$routNameES = 'es.' . $routName;
$sess_lang = $request->session()->get('lang', config('app.locale'));
switch ($sess_lang) {
case 'en':
return redirect()->route($routNameEN, $routeParams);
case 'es':
return redirect()->route($routNameES, $routeParams);
}
}
// $this->saveUserLocale($langset, $request);
// } else {
// // Not specified in route.
// if ($this->checkFirstAccess($request)) {
// $routNameEN = 'en.' . $routName;
// $routNameES = 'es.' . $routName;
// $sess_lang = $request->session()->get('lang', config('app.locale'));
// switch ($sess_lang) {
// case 'en':
// return redirect()->route($routNameEN, $routeParams);
// case 'es':
// return redirect()->route($routNameES, $routeParams);
// }
// }
// $langset = 'fr';
// $this->saveUserLocale($langset, $request);
// }//end if
$langset = 'fr';
$this->saveUserLocale($langset, $request);
} //end if
}//end if
// phpcs:enable

View file

@ -16,9 +16,7 @@ return [
* just add '/backoffice' into this table
*/
'ignoreRoutes' => [
'/bo',
'/en',
'/es'
'/bo'
],
/**

View file

@ -99,13 +99,11 @@
</nav>
<span class="secondmenu">
@if (config('app.env') != 'production')
<ul class="traduction">
<li class="@if(App::getLocale() == 'fr') current @endif"><a href="{{ route($currentRouteFR, $routeParamsFR) }}">fr</a></li>
<li class="@if(App::getLocale() == 'en') current @endif"><a href="{{ route($currentRouteEN, $routeParamsEN) }}">en</a></li>
<li class="@if(App::getLocale() == 'es') current @endif"><a href="{{ route($currentRouteES, $routeParamsES) }}">es</a></li>
</ul>
@endif
<div class="search-bloc search-form">
<form class="form" method="GET" action="{{ route($routeprefixer . 'search') }}">
<label for="filter">{{ __("Recherchez un produit") }}</label>
@ -129,8 +127,8 @@
<script>
var loupe = document.querySelector("div#search");
loupe.addEventListener("click", function () {
loupe.addEventListener("click", function() {
document.querySelector("div.search-form").classList.toggle('is-visible');
});
</script>
@endpush
@endpush