090 Option de marge en haut du site non fluide et correction theme dans core.php

This commit is contained in:
Fred Tempez 2020-05-08 21:14:29 +02:00
parent 1573fa7695
commit c584612549
4 changed files with 25 additions and 7 deletions

View File

@ -36,7 +36,7 @@ class common {
const THUMBS_WIDTH = 640;
// Numéro de version
const ZWII_VERSION = '10.0.089';
const ZWII_VERSION = '10.0.090';
const ZWII_UPDATE_CHANNEL = "v10";
public static $actions = [];
@ -1318,7 +1318,8 @@ class core extends common {
// Couleur fixée dans admin.css
//$css .= '.button.buttonGrey,.button.buttonGrey:hover{color:' . $this->getData(['theme', 'text', 'textColor']) . '}';
$css .= '.container{max-width:' . $this->getData(['theme', 'site', 'width']) . '}';
$css .= $this->getData(['theme', 'site', 'width']) === '100%' ? '#site{margin:0 auto !important;} body{margin:0 auto !important;} #bar{margin:0 auto !important;} body > header{margin:0 auto !important;} body > nav {margin: 0 auto !important;} body > footer {margin:0 auto !important;}': '';
$margin = $this->getData(['theme', 'site', 'margin']) ? '0' : '20px';
$css .= $this->getData(['theme', 'site', 'width']) === '100%' ? '#site{margin:0 auto !important;} body{margin:0 auto !important;} #bar{margin:0 auto !important;} body > header{margin:0 auto !important;} body > nav {margin: 0 auto !important;} body > footer {margin:0 auto !important;}': "#site{margin: " . $margin . " auto !important;} body{margin:0px 10px;} #bar{margin: 0 -10px;} body > header{margin: 0 -10px;} body > nav {margin: 0 -10px;} body > footer {margin: 0 -10px;} ";
$css .= $this->getData(['theme', 'site', 'width']) === '750px' ? '.button, button{font-size:0.8em;}' : '';
$css .= '#site{background-color:' . $this->getData(['theme', 'site', 'backgroundColor']) . ';border-radius:' . $this->getData(['theme', 'site', 'radius']) . ';box-shadow:' . $this->getData(['theme', 'site', 'shadow']) . ' #212223;}';
$css .= '.editorWysiwyg {background-color:' . $this->getData(['theme', 'site', 'backgroundColor']) . ';}';

View File

@ -519,7 +519,8 @@ class theme extends common {
'backgroundColor' => $this->getInput('themeSiteBackgroundColor'),
'radius' => $this->getInput('themeSiteRadius'),
'shadow' => $this->getInput('themeSiteShadow'),
'width' => $this->getInput('themeSiteWidth')
'width' => $this->getInput('themeSiteWidth'),
'margin' => $this->getInput('themeSiteMargin',helper::FILTER_BOOLEAN)
]]);
// Valeurs en sortie
$this->addOutput([

View File

@ -21,6 +21,15 @@ $( document).ready(function() {
* Aperçu en direct
*/
$("input, select").on("change",function() {
/**
* Option de marge si la taille n'est pas fluide
*/
if ($('#themeSiteWidth').val() === '100%') {
$("#themeSiteMargin").prop("checked", true);
$("#themeSiteMargin").addClass("disabled");
} else {
$("#themeSiteMargin").addClass("enabled");
}
updateDOM();
});
@ -68,12 +77,12 @@ function updateDOM() {
css += ".button, button{font-size:1em;}";
}
// Largeur du site
var margin = $("#themeSiteMargin").is(":checked") ? 0 : '20px' ;
css += ".container{max-width:" + $("#themeSiteWidth").val() + "}";
if ($("#themeSiteWidth").val() === "100%") {
css += "#site{margin:0 auto;} body{margin:0 auto;} #bar{margin:0 auto;} body > header{margin:0 auto;} body > nav {margin: 0 auto;} body > footer {margin:0 auto;}";
css += "#site{margin: 0px auto;} body{margin:0 auto;} #bar{margin:0 auto;} body > header{margin:0 auto;} body > nav {margin: 0 auto;} body > footer {margin:0 auto;}";
} else {
css += "#site{margin:20px auto !important;} body{margin:0px 10px;} #bar{margin: 0 -10px;} body > header{margin: 0 -10px;} body > nav {margin: 0 -10px;} body > footer {margin: 0 -10px;} ";
css += "#site{margin: " + margin + " auto !important;} body{margin:0px 10px;} #bar{margin: 0 -10px;} body > header{margin: 0 -10px;} body > nav {margin: 0 -10px;} body > footer {margin: 0 -10px;} ";
}
// Couleur du site, arrondi sur les coins du site et ombre sur les bords du site
//css += "#site{background-color:" + $("#themeSiteBackgroundColor").val() + ";border-radius:" + $("#themeSiteRadius").val() + ";box-shadow:" + $("#themeSiteShadow").val() + " #212223}";

View File

@ -162,6 +162,13 @@
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('themeSiteMargin',true, 'Pas de marge au-dessus et en-dessous du site', [
'checked' => $this->getData(['theme', 'site', 'margin'])
]); ?>
</div>
</div>
</div>
</div>
</div>