menu accessoire, retour à la version la première du js

This commit is contained in:
fredtempez 2022-03-08 11:32:55 +01:00
parent 4c406844cb
commit 015b0377ea
1 changed files with 12 additions and 6 deletions

View File

@ -239,10 +239,12 @@ $( document ).ready(function() {
*/
if ($("#pageEditExtraPosition").val() == 1 ) {
var positionDOM = $("#pageEditPosition");
var positionInitial = <?php echo $this->getData(['page',$this->getUrl(2),"position"]); ?>;
positionDOM.empty().append(
$("<option>").val(0).text("Ne pas afficher"),
$("<option>").val(1).text("Au début")
);
$("#pageEditPosition").val(positionInitial);
}
});
@ -525,12 +527,16 @@ $("#pageEditExtraPosition").on("change", function() {
if ($("#pageEditExtraPosition").val() == 1 ) {
var positionDOM = $("#pageEditPosition");
/*
positionDOM.empty().append(
$("<option>").val(0).text("Ne pas afficher"),
$("<option>").val(1).text("Au début")
);
$("#pageEditPosition").val(1);
*/
getPages(true);
} else {
getPages();
getPages(false);
//$("#pageEditParentPageId").trigger("change");
}
});
@ -546,14 +552,14 @@ $("#pageEditModuleConfig").on("click", function() {
* Affiche les pages en fonction de la page parent dans le choix de la position
*/
$("#pageEditParentPageId").on("change", function() {
getPages();
getPages(false);
}).trigger("change");
/**
* Construit un select contenant la liste des pages du site.
*/
function getPages() {
function getPages(extra) {
var hierarchy = <?php echo json_encode($this->getHierarchy()); ?>;
var pages = <?php echo json_encode($this->getData(['page'])); ?>;
var positionInitial = <?php echo $this->getData(['page',$this->getUrl(2),"position"]); ?>;
@ -567,12 +573,12 @@ function getPages() {
var positionSelected = 0;
var positionPrevious = 1;
// Aucune page parent selectionnée
// Aucune page parent sélectionnée
if(parentSelected === "") {
// Liste des pages sans parents
for(var key in hierarchy) {
if(hierarchy.hasOwnProperty(key) &&
extraPosition == pages[key].extraPosition ) {
extra === false ) {
// Sélectionne la page avant s'il s'agit de la page courante
if(key === "<?php echo $this->getUrl(2); ?>") {
positionSelected = positionPrevious;
@ -592,7 +598,7 @@ function getPages() {
positionSelected = 0;
}
}
// Un page parent est sélectionnée
// Une page parent est sélectionnée
else {
// Liste des pages enfants de la page parent
for(var i = 0; i < hierarchy[parentSelected].length; i++) {