From 9f9dc7f806a86e68988c1b208c13cbf733160d20 Mon Sep 17 00:00:00 2001 From: nicod_ <nicod@lerebooteux.fr> Date: Sun, 16 Apr 2023 20:31:10 +0200 Subject: [PATCH] =?UTF-8?q?Affichage=20du=20rang=20et=20rechargement=20aja?= =?UTF-8?q?x=20de=20la=20liste=20des=20blocs=20apr=C3=A8s=20un=20changemen?= =?UTF-8?q?t=20de=20rang?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blocks_pipelines.php | 2 +- javascript/gestion_listes_blocs.js.html | 23 +---------------------- prive/squelettes/inclure/blocs_objet.html | 4 +++- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/blocks_pipelines.php b/blocks_pipelines.php index 91dc86d..9e508e1 100644 --- a/blocks_pipelines.php +++ b/blocks_pipelines.php @@ -34,7 +34,7 @@ function blocks_afficher_contenu_objet($flux) { 'objet' => $objet, 'id_objet' => $id_objet ], - ['ajax' => true] + ['ajax' => 'blocs_objet'] ); if ($p = strpos($flux['data'], '<!--affiche_milieu-->')) { $flux['data'] = substr_replace($flux['data'], $texte, $p, 0); diff --git a/javascript/gestion_listes_blocs.js.html b/javascript/gestion_listes_blocs.js.html index c5acba2..1639a55 100644 --- a/javascript/gestion_listes_blocs.js.html +++ b/javascript/gestion_listes_blocs.js.html @@ -60,32 +60,11 @@ function ordonner_listes_blocs() { dataType: 'json', cache: false, }).done(function(data) { - - const couleur_origine = $item.css('background-color'); - const couleur_erreur = $("<div class='remove'></div>").css('background-color'); - const couleur_succes = $("<div class='append'></div>").css('background-color'); - $item.endLoading(true); - - if (data.errors.length) { - $item.css({backgroundColor: couleur_erreur}).animate({backgroundColor: couleur_origine}, 'normal', () => { - $item.css({backgroundColor: ''}); - }); - } else { - $item.css({backgroundColor: couleur_succes}).animate({backgroundColor: couleur_origine}, 'normal', () => { - $item.css({backgroundColor: ''}); - }); - $items.parent().find('.tout_desordonner').show(); - } + ajaxReload('blocs_objet'); }); } }); - // bouton "désordonner" - if ($(this).parent().find('.deplacer-bloc[data-rang!=0]').length) { - $(this).parent().find('.tout_desordonner').show(); - } else { - $(this).parent().find('.tout_desordonner').hide(); - } }); } } diff --git a/prive/squelettes/inclure/blocs_objet.html b/prive/squelettes/inclure/blocs_objet.html index 37c5ce9..97225ab 100644 --- a/prive/squelettes/inclure/blocs_objet.html +++ b/prive/squelettes/inclure/blocs_objet.html @@ -6,7 +6,9 @@ <BOUCLE(BLOCS) {objet}{id_objet} {statut?} {par rang_lien}> <div class="item bloc statut_#STATUT" id="bloc#ID_BLOC" data-id="#ID_BLOC"> <h3 class="titrem bloc__type"> - [(#CHEMIN_IMAGE{bloc-16.png}|balise_img)]#INFO_TITRE{blocs_types,#ID_BLOCS_TYPE} + [(#CHEMIN_IMAGE{bloc-16.png}|balise_img)] + ##RANG_LIEN + #INFO_TITRE{blocs_types,#ID_BLOCS_TYPE} [(#AUTORISER{modifier,bloc,#ID_BLOC}) <span class="deplacer-bloc" data-rang="#RANG_LIEN"> <img src='#CHEMIN_IMAGE{deplacer-16.png}' width='16' height='16' alt='<:medias:ordonner_ce_document|attribut_html:>' title='<:medias:ordonner_ce_document|attribut_html:>' /> -- GitLab