Commit ac884e97 authored by Fabrice Gangler's avatar Fabrice Gangler 🎨
Browse files

REFACTOR: add appVersion to AppController

parent 6305d0f8
......@@ -34,6 +34,7 @@ use Crud\Controller\ControllerTrait;
class AppController extends Controller
{
use AppCacheTrait;
use ControllerTrait;
private $breadcrumbs = [];
......@@ -44,15 +45,14 @@ class AppController extends Controller
'en' => 'en',
'fr' => 'fr',
];
use ControllerTrait;
protected $explicitLanguages = [
'en' => 'english',
'fr' => 'français',
];
protected $selectedLanguage = 'en';
protected $appVersion;
/**
* Initialization hook method.
*
......@@ -100,6 +100,8 @@ class AppController extends Controller
);
$this->loadComponent('ValidationRules');
$this->appVersion = Configure::read("VERSION.footer");
}
/**
......@@ -142,6 +144,7 @@ class AppController extends Controller
$this->RequestHandler->renderAs($this, 'json');
$this->set('_serialize', true);
}
$this->set('appVersion', $this->appVersion);
$this->set('appFullBaseUrl', Configure::read('App.fullBaseUrl'));
$this->set('breadcrumbs', $this->getBreadcrumbs());
}
......
......@@ -5,6 +5,13 @@
if (!isset($selectedLanguage)) {
$selectedLanguage = __d("default", "lang.id"); // "fr" or "en"
}
// This template is used all the time (even on error pages).
// But, on error pages, the $appVersion variable is not available.
// We force its creation that is always available.
if (!isset($appVersion)) {
$appVersion = Cake\Core\Configure::read("VERSION.footer");
}
?>
<div class="navbar">
......@@ -23,13 +30,13 @@
<?php if ($this->isHere("pages", "index")): ?>
<span class="navbar-brand cdl-navbar-logo ">
<?= "<h1 class = 'cdl-navbar-logo'> ". $this->Html->image(
"logos/Logo-CDL_kranken.io-lossless.png",
"logos/Logo-CDL_kranken.io-lossless.png?$appVersion",
["alt" => __d("ElementNavigation", "Comptoir du libre")]) . "</h1>"?>
</span>
<?php elseif ($this->request->here != $this->request->base): ?>
<span class="navbar-brand cdl-navbar-logo-link">
<?= $this->Html->link(
$this->Html->image("logos/Logo-CDL_kranken.io-lossless.png",
$this->Html->image("logos/Logo-CDL_kranken.io-lossless.png?$appVersion",
["alt" => __d("ElementNavigation", "Comptoir du libre - back home")]),
"/$selectedLanguage/",
['escape' => false, "class" => "cdl-navbar-logo-link"]) ?>
......
......@@ -11,6 +11,13 @@
$selectedLanguage = __d("default", "lang.id"); // "fr" or "en"
}
// This template is used all the time (even on error pages).
// But, on error pages, the $appVersion variable is not available.
// We force its creation that is always available.
if (!isset($appVersion)) {
$appVersion = Cake\Core\Configure::read("VERSION.footer");
}
// Set options to footer links
$optionLegalLink = [];
......@@ -80,7 +87,7 @@
</div>
<div>
<?= $this->Html->link(
$this->Html->image("logos/Logo_FEDER_kraken.io-lossy.png",[
$this->Html->image("logos/Logo_FEDER_kraken.io-lossy.png?$appVersion",[
"alt" => "Site web du 'Fonds Européen de Développement Régional' de la région Occitanie",
"id" => "Feder-logo",
"loading" => "lazy"
......@@ -94,7 +101,7 @@
</div>
<div class="footer-version">
<?= __d("Pages", "Comptoir du Libre version ") ?>
<?= $this->Html->link( \Cake\Core\Configure::read("VERSION.footer"),
<?= $this->Html->link( $appVersion,
'https://gitlab.adullact.net/Comptoir/Comptoir-srv/blob/master/CHANGELOG.md',
[
'escape' => false,
......
<?php
// This template is used all the time (even on error pages).
// But, on error pages, the $appVersion variable is not available.
// We force its creation that is always available.
if (!isset($appVersion)) {
$appVersion = Cake\Core\Configure::read("VERSION.footer");
}
?>
<div class="container-fluid" id="parentship">
<div class="row">
<div class="col-sm-12">
......@@ -6,10 +13,11 @@
<?= __d("Pages","Paternity.message")?>
</span>
<?= $this->Html->link(
$this->Html->image("logos/Logo_adullact_trunked_kraken.io-lossless.png",
$this->Html->image("logos/Logo_adullact_trunked_kraken.io-lossless.png?$appVersion",
["alt" => "Adullact","id" => "parentship-logo"]),
"https://adullact.org",
['escape' => false ,"target"=>"_blank"]) ?>
['escape' => false ,"target"=>"_blank", 'rel' => 'noopener']
) ?>
</div>
</div>
</div>
......
......@@ -3,6 +3,13 @@
/**
* This template conatins all informations for the header
*/
// This template is used all the time (even on error pages).
// But, on error pages, the $appVersion variable is not available.
// We force its creation that is always available.
if (!isset($appVersion)) {
$appVersion = Cake\Core\Configure::read("VERSION.footer");
}
?>
<head>
......@@ -14,23 +21,23 @@
<meta name="author" content="">
<!-- ****** faviconit.com favicons ****** -->
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.ico', ['type' => 'icon', 'rel' => 'shortcut icon']); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.16_16.ico', ['type' => 'icon', "sizes" => "16x16 32x32 64x64"]); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.196_196.png', ['type' => 'icon', "sizes" => "196x196"]); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.160_160.png', ['type' => 'icon', "sizes" => "160x160"]); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.96_96.png', ['type' => 'icon', "sizes" => "96x96"]); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.64_64.png', ['type' => 'icon', "sizes" => "64x64"]); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.32_32.png', ['type' => 'icon', "sizes" => "32x32"]); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.16_16.png', ['type' => 'icon', "sizes" => "16x16"]); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.svg', ['type' => 'icon', 'rel' => 'apple-touch-icon']); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.114_114.png', ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '114x114']); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.72_72.png', ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '72x72']); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.144_144.png', ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '144x144']); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.60_60.png', ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '60x60']); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.120_120.png', ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '120x120']); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.76_76.png', ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '76x76']); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.152_152.png', ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '152x152']); ?>
<?= $this->Html->meta('favicon.ico', 'img/favicon/CDL-Favicon.180_180.png', ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '180x180']); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.ico?$appVersion", ['type' => 'icon', 'rel' => 'shortcut icon']); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.16_16.ico?$appVersion", ['type' => 'icon', "sizes" => "16x16 32x32 64x64"]); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.196_196.png?$appVersion", ['type' => 'icon', "sizes" => "196x196"]); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.160_160.png?$appVersion", ['type' => 'icon', "sizes" => "160x160"]); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.96_96.png?$appVersion", ['type' => 'icon', "sizes" => "96x96"]); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.64_64.png?$appVersion", ['type' => 'icon', "sizes" => "64x64"]); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.32_32.png?$appVersion", ['type' => 'icon', "sizes" => "32x32"]); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.16_16.png?$appVersion", ['type' => 'icon', "sizes" => "16x16"]); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.svg?$appVersion", ['type' => 'icon', 'rel' => 'apple-touch-icon']); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.114_114.png?$appVersion", ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '114x114']); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.72_72.png?$appVersion", ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '72x72']); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.144_144.png?$appVersion", ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '144x144']); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.60_60.png?$appVersion", ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '60x60']); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.120_120.png?$appVersion", ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '120x120']); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.76_76.png?$appVersion", ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '76x76']); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.152_152.png?$appVersion", ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '152x152']); ?>
<?= $this->Html->meta('favicon.ico', "img/favicon/CDL-Favicon.180_180.png?$appVersion", ['type' => 'icon', 'rel' => 'apple-touch-icon', 'sizes' => '180x180']); ?>
<?php
// <meta name="msapplication-TileColor" content="#FFFFFF">
// <meta name="msapplication-TileImage" content="favicon/favicon-144.png">
......@@ -46,7 +53,7 @@
<?= $this->OpenGraph
->setTitle($openGraph["title"])
->setDescription($openGraph["description"])
->setImage($openGraph["image"], $openGraph["imageSize"])
->setImage($openGraph["image"]."?$appVersion", $openGraph["imageSize"])
->render(); ?>
<?php endif ; ?>
......@@ -55,17 +62,17 @@
->setTitle($card["title"])
->setCard(\Cake\Core\Configure::read("OpenGraph.card"))
->setDescription($card["description"])
->setImage($card["image"], $card["imageSize"])
->setImage($card["image"]."?$appVersion", $card["imageSize"])
->render(); ?>
<?php endif ; ?>
<?= $this->Html->css('bootstrap/css/bootstrap.min.css?'. \Cake\Core\Configure::read("VERSION.footer")) ?>
<?= $this->Html->css('font-awesome-4.7.0/css/font-awesome.min.css?'. \Cake\Core\Configure::read("VERSION.footer")) ?>
<?= $this->Html->css('comptoir.css?'. \Cake\Core\Configure::read("VERSION.footer")) ?>
<?= $this->Html->css('bootstrap/css/bootstrap.min.css?'. $appVersion) ?>
<?= $this->Html->css('font-awesome-4.7.0/css/font-awesome.min.css?'. $appVersion) ?>
<?= $this->Html->css('comptoir.css?'. $appVersion) ?>
<?= $this->Html->script('jquery/jquery.min.js?'. \Cake\Core\Configure::read("VERSION.footer")) ?>
<?= $this->Html->script('bootstrap/js/bootstrap.min.js?'. \Cake\Core\Configure::read("VERSION.footer")) ?>
<?= $this->Html->script('bootstrap/js/simpleAccessible.js?'. \Cake\Core\Configure::read("VERSION.footer")) ?>
<?= $this->Html->script('jquery/jquery.min.js?'. $appVersion) ?>
<?= $this->Html->script('bootstrap/js/bootstrap.min.js?'. $appVersion) ?>
<?= $this->Html->script('bootstrap/js/simpleAccessible.js?'. $appVersion) ?>
<?= $this->fetch('meta') ?>
......
......@@ -9,6 +9,13 @@
if (!isset($selectedLanguage)) {
$selectedLanguage = __d("default", "lang.id"); // "fr" or "en"
}
// This template is used all the time (even on error pages).
// But, on error pages, the $appVersion variable is not available.
// We force its creation that is always available.
if (!isset($appVersion)) {
$appVersion = Cake\Core\Configure::read("VERSION.footer")."aaaaaaaaaaaaaaaaa";
}
?>
<!DOCTYPE html>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment