[9.1.13] jquery du footer en cours de réécriture

This commit is contained in:
fredtempez 2019-06-19 21:37:16 +02:00
parent 130ad549dd
commit 5688d78bb4
2 changed files with 51 additions and 102 deletions

View File

@ -25,9 +25,9 @@ $("input, select").on("change", function() {
var css = "footer{background-color:" + colors.normal + ";color:" + textColor + "}"; var css = "footer{background-color:" + colors.normal + ";color:" + textColor + "}";
css += "footer a{color:" + textColor + "}"; css += "footer a{color:" + textColor + "}";
// Hauteur du pied de page // Hauteur du pied de page
css += "footer .container > #footersiteLeft, #footersiteCenter, #footersiteRight {padding:" + $("#themeFooterHeight").val() + " 0}"; css += "footer .container > div{margin:" + $("#themeFooterHeight").val() + " 0}";
//css += "footer .container > div{padding:0}"; //css += "footer .container > div{padding:0}";
css += "footer .container-large > #footersiteLeft, #footersiteCenter, #footersiteRight {padding:" + $("#themeFooterHeight").val() + " 0}"; css += "footer .container-large > div{margin:" + $("#themeFooterHeight").val() + " 0}";
//css += "footer .container-large > div{padding:0}"; //css += "footer .container-large > div{padding:0}";
// Alignement du contenu // Alignement du contenu
css += "#footerSocials{text-align:" + $("#themeFooterSocialsAlign").val() + "}"; css += "#footerSocials{text-align:" + $("#themeFooterSocialsAlign").val() + "}";
@ -63,24 +63,24 @@ $("input, select").on("change", function() {
} }
}); });
// Position dans les blocs // Position dans les blocs
// Bloc texte personnalisé // Bloc texte personnalisé
$("#themeFooterForm").on("change",function() { $(".themeFooterContent").on("change",function() {
var position = $(".themeFooterContent").val();
switch($("#themeFooterTextPosition").val()) { switch($("#themeFooterTextPosition").val()) {
case "hide": case "hide":
$("#footerText").hide(); $("#footerText").hide();
break; break;
case "left": case "left":
$("#footerText").show().appendTo("#footerbodyLeft"); $("#footerText").show().appendTo("#footer" + position + "Left");
$("#footerText").show().appendTo("#footersiteLeft");
break; break;
case "center": case "center":
$("#footerText").show().appendTo("#footerbodyCenter"); $("#footerText").show().appendTo("#footer" + position + "Center");
$("#footerText").show().appendTo("#footersiteCenter");
break; break;
case "right": case "right":
$("#footerText").show().appendTo("#footerbodyRight"); $("#footerText").show().appendTo("#footer" + position + "Right");
$("#footerText").show().appendTo("#footersiteRight");
break; break;
} }
switch($("#themeFooterSocialsPosition").val()) { switch($("#themeFooterSocialsPosition").val()) {
@ -88,16 +88,13 @@ $("#themeFooterForm").on("change",function() {
$("#footerSocials").hide(); $("#footerSocials").hide();
break; break;
case 'left': case 'left':
$("#footerSocials").show().appendTo("#footerbodyLeft"); $("#footerSocials").show().appendTo("#footer" + position + "Left");
$("#footerSocials").show().appendTo("#footersiteLeft");
break; break;
case 'center': case 'center':
$("#footerSocials").show().appendTo("#footerbodyCenter"); $("#footerSocials").show().appendTo("#footer" + position + "Center");
$("#footerSocials").show().appendTo("#footersiteCenter");
break; break;
case 'right': case 'right':
$("#footerSocials").show().appendTo("#footerbodyRight"); $("#footerSocials").show().appendTo("#footer" + position + "Right");
$("#footerSocials").show().appendTo("#footersiteRight");
break; break;
} }
switch($("#themeFooterCopyrightPosition").val()) { switch($("#themeFooterCopyrightPosition").val()) {
@ -105,23 +102,19 @@ $("#themeFooterForm").on("change",function() {
$("#footerCopyright").hide(); $("#footerCopyright").hide();
break; break;
case 'left': case 'left':
$("#footerCopyright").show().appendTo("#footerbodyLeft"); $("#footerCopyright").show().appendTo("#footer" + position + "Left");
$("#footerCopyright").show().appendTo("#footersiteLeft");
break; break;
case 'center': case 'center':
$("#footerCopyright").show().appendTo("#footerbodyCenter"); $("#footerCopyright").show().appendTo("#footer" + position + "Center");
$("#footerCopyright").show().appendTo("#footersiteCenter");
break; break;
case 'right': case 'right':
$("#footerCopyright").show().appendTo("#footerbodyRight"); $("#footerCopyright").show().appendTo("#footer" + position + "Right");
$("#footerCopyright").show().appendTo("#footersiteRight");
break; break;
} }
}).trigger("change"); }).trigger("change");
// Fin Position dans les blocs
// Modification dynamique de la mise en page
// Modification de la mise en page
$("#themeFooterTemplate").on("change",function() { $("#themeFooterTemplate").on("change",function() {
// Nettoyage des sélecteurs des contenus // Nettoyage des sélecteurs des contenus
var newOptions = { var newOptions = {
@ -129,96 +122,53 @@ $("#themeFooterTemplate").on("change",function() {
2: {'hide': 'Masqué', 'left': 'Bloc Gauche', 'right': 'Bloc Droite'} , 2: {'hide': 'Masqué', 'left': 'Bloc Gauche', 'right': 'Bloc Droite'} ,
1: {'hide': 'Masqué', 'center': 'Affiché'} 1: {'hide': 'Masqué', 'center': 'Affiché'}
}; };
var $el = $(".themeFooterPosition"); var $el = $(".themeFooterContent");
$el.empty(); $el.empty();
// Eléments des position de contenus // Eléments des position de contenus
$.each(newOptions[$("#themeFooterTemplate").val()], function(key,value) { $.each(newOptions[$("#themeFooterTemplate").val()], function(key,value) {
$el.append($("<option></option>") $el.append($("<option></option>")
.attr("value", key).text(value)); .attr("value", key).text(value));
}); });
var position = $("#themeFooterPosition").val();
// Masquer le contenus
$("#footerCopyright").hide();
$("#footerText").hide();
$("#footerSocials").hide();
console.log(position);
switch($("#themeFooterTemplate").val()) { switch($("#themeFooterTemplate").val()) {
case "1": case "1":
console.log("1"); $("#footer" + position + "Left").css("display","none");
$("#footersiteLeft").css("display", "none"); $("#footer" + position + "Center").css("display","");
$("#footersiteCenter").css("display", ""); $("#footer" + position + "Right").css("display","none");
$("#footersiteRight").css("display", "none");
// Dimension du bloc // Dimension du bloc
$("#footersiteCenter").removeAttr('class');; $("#footer" + position + "Center").removeAttr('class');
$("#footersiteCenter").addClass("col12"); $("#footer" + position + "Center").addClass("col12");
break; break;
case "2": case "2":
console.log("2"); $("#footer" + position + "Left").css("display","");
$("#footersiteLeft").css("display", ""); $("#footer" + position + "Center").css("display","none");
$("#footersiteCenter").css("display", "none"); $("#footer" + position + "Right").css("display","");
$("#footersiteRight").css("display", "");
// Dimension de blocs // Dimension de blocs
$("#footersiteLeft").removeAttr('class'); $("#footer" + position + "Left").removeAttr('class');
$("#footersiteRight").removeAttr('class'); $("#footer" + position + "Right").removeAttr('class');
$("#footersiteLeft").addClass('col6'); $("#footer" + position + "Left").addClass('col6');
$("#footersiteRight").addClass('col6'); $("#footer" + position + "Right").addClass('col6');
break; break;
case "3": case "3":
console.log("3"); $("#footer" + position + "Left").css("display","");
$("#footersiteLeft").css("display", ""); $("#footer" + position + "Center").css("display","");
$("#footersiteCenter").css("display", ""); $("#footer" + position + "Right").css("display","");
$("#footersiteRight").css("display", ""); // Dimension de blocs
// Dimensions des blocs $("#footer" + position + "Left").removeAttr('class');
$("#footersiteLeft").removeAttr('class'); $("#footer" + position + "Right").removeAttr('class');
$("#footersiteRight").removeAttr('class'); $("#footer" + position + "center").removeAttr('class');
$("#footersitecenter").removeAttr('class'); $("#footer" + position + "Left").addClass('col4');
$("#footersiteLeft").addClass('col4'); $("#footer" + position + "Center").addClass('col4');
$("#footersiteCenter").addClass('col4'); $("#footer" + position + "Right").addClass('col4');
$("#footersiteRight").addClass('col4');
break; break;
} }
}); });
// Affichage des options possibles
// $('#baba').prop('selectedIndex',0);
$("#themeFooterSocialsPosition").on("change", function() {
if ($("#themeFooterTemplate").val() === "1") {
if ($(this).prop('selectedIndex') === 1) {
$("#themeFooterTextPosition").prop('selectedIndex',0);
$("#themeFooterCopyrightPosition").prop('selectedIndex',0);
}
}
if ($("#themeFooterTemplate").val() === "2") {
if ($(this).prop('selectedIndex') === $(this)) {
$("#themeFooterTextPosition").prop('selectedIndex',0);
$("#themeFooterCopyrightPosition").prop('selectedIndex',0);
}
}
});
$("#themeFooterTextPosition").on("change", function() {
if ($("#themeFooterTemplate").val() === "1") {
if ($(this).prop('selectedIndex') === 1) {
$("#themeFooterSocialsPosition").prop('selectedIndex',0);
$("#themeFooterCopyrightPosition").prop('selectedIndex',0);
}
}
if ($("#themeFooterTemplate").val() === "2") {
if ($(this).prop('selectedIndex') === $(this)) {
$("#themeFooterSocialsPosition").prop('selectedIndex',0);
$("#themeFooterCopyrightPosition").prop('selectedIndex',0);
}
}
});
$("#themeFooterCopyrightPosition").on("change", function() {
if ($("#themeFooterTemplate").val() === "1") {
if ($(this).prop('selectedIndex') === 1) {
$("#themeFooterSocialsPosition").prop('selectedIndex',0);
$("#themeFooterTextPosition").prop('selectedIndex',0);
}
}
if ($("#themeFooterTemplate").val() === "2") {
if ($(this).prop('selectedIndex') === $(this)) {
$("#themeFooterSocialsPosition").prop('selectedIndex',0);
$("#themeFooterTextPosition").prop('selectedIndex',0);
}
}
});
// Lien de connexion // Lien de connexion
$("#themeFooterLoginLink").on("change", function() { $("#themeFooterLoginLink").on("change", function() {

View File

@ -112,12 +112,11 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col4"> <div class="col4">
<p><strong>Contenu personnalisé texte ou HTML :</strong></p> <p><strong>Contenu personnalisé texte ou HTML :</strong></p>
<?php echo template::select('themeFooterTextPosition', $footerBlockPosition, [ <?php echo template::select('themeFooterTextPosition', $footerBlockPosition, [
'label' => 'Emplacement', 'label' => 'Emplacement',
'selected' => $this->getData(['theme', 'footer', 'textPosition']), 'selected' => $this->getData(['theme', 'footer', 'textPosition']),
'class' => 'themeFooterPosition' 'class' => 'themeFooterContent'
]); ?> ]); ?>
<?php echo template::select('themeFooterTextAlign', $module::$aligns, [ <?php echo template::select('themeFooterTextAlign', $module::$aligns, [
'label' => 'Alignement', 'label' => 'Alignement',
@ -129,7 +128,7 @@
<?php echo template::select('themeFooterSocialsPosition', $footerBlockPosition, [ <?php echo template::select('themeFooterSocialsPosition', $footerBlockPosition, [
'label' => 'Emplacement', 'label' => 'Emplacement',
'selected' => $this->getData(['theme', 'footer', 'socialsPosition']), 'selected' => $this->getData(['theme', 'footer', 'socialsPosition']),
'class' => 'themeFooterPosition' 'class' => 'themeFooterContent'
]); ?> ]); ?>
<?php echo template::select('themeFooterSocialsAlign', $module::$aligns, [ <?php echo template::select('themeFooterSocialsAlign', $module::$aligns, [
'label' => 'Alignement', 'label' => 'Alignement',
@ -141,7 +140,7 @@
<?php echo template::select('themeFooterCopyrightPosition', $footerBlockPosition, [ <?php echo template::select('themeFooterCopyrightPosition', $footerBlockPosition, [
'label' => 'Emplacement', 'label' => 'Emplacement',
'selected' => $this->getData(['theme', 'footer', 'copyrightPosition']), 'selected' => $this->getData(['theme', 'footer', 'copyrightPosition']),
'class' => 'themeFooterPosition' 'class' => 'themeFooterContent'
]); ?> ]); ?>
<?php echo template::select('themeFooterCopyrightAlign', $module::$aligns, [ <?php echo template::select('themeFooterCopyrightAlign', $module::$aligns, [
'label' => 'Alignement', 'label' => 'Alignement',