|
|
|
@ -3,24 +3,20 @@
|
|
|
|
|
|
|
|
|
|
Gestion des listes de blocks :
|
|
|
|
|
- Gestion du tri par glisser-déposer
|
|
|
|
|
|
|
|
|
|
Markup :
|
|
|
|
|
- Listes : .liste_items.blocks
|
|
|
|
|
- Listes ordonnables : .liste_items.blocks.ordonner_rang_lien\[data-lien\]
|
|
|
|
|
|
|
|
|
|
- Edition en place (ajax)
|
|
|
|
|
*/]
|
|
|
|
|
|
|
|
|
|
/* Gestion du tri des listes de blocks et de leur enregistrement */
|
|
|
|
|
function ordonner_listes_blocks() {
|
|
|
|
|
|
|
|
|
|
if (typeof Sortable === 'function') {
|
|
|
|
|
$(".liste_items.blocks.ordonner_rang_lien[data-lien]").find('> .sortable').each(function () {
|
|
|
|
|
$(".objet_blocks[data-lien]").find('> .sortable').each(function () {
|
|
|
|
|
// détruire / recréer le sortable à chaque appel ajax
|
|
|
|
|
if (Sortable.get(this)) {
|
|
|
|
|
Sortable.get(this).destroy();
|
|
|
|
|
}
|
|
|
|
|
// pas de tri possible s'il n'y a qu'un seul élément.
|
|
|
|
|
if ($(this).find('> .item').length < 2) {
|
|
|
|
|
if ($(this).find('> .objetblock').length < 2) {
|
|
|
|
|
$(this).find('.deplacer-block').hide();
|
|
|
|
|
$(this).parent().find('.tout_desordonner').hide();
|
|
|
|
|
return true; // continue
|
|
|
|
@ -44,7 +40,7 @@ function ordonner_listes_blocks() {
|
|
|
|
|
const $item = $(event.item);
|
|
|
|
|
|
|
|
|
|
// l'objet lié est indiqué dans l'attribut data-lien sur la liste
|
|
|
|
|
const [objet_lie, id_objet_lie] = $items.parents(".liste_items.blocks").data("lien").split("/");
|
|
|
|
|
const [objet_lie, id_objet_lie] = $items.parents(".objet_blocks").data("lien").split("/");
|
|
|
|
|
const action = '[(#VAL{ordonner_liens_blocks}|generer_url_action{"", 1})]';
|
|
|
|
|
const params = {
|
|
|
|
|
objet_source: 'block',
|
|
|
|
@ -87,9 +83,9 @@ if (window.jQuery) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
|
$('.liste_items.blocks .actions .editer_block').on('click', function(e) {
|
|
|
|
|
$('.objet_blocks .actions .editer_block').on('click', function(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
let $parent = $(this).parents('.item.block').first();
|
|
|
|
|
let $parent = $(this).parents('.objetblock').first();
|
|
|
|
|
let $content = $parent.find('.objetblock__content');
|
|
|
|
|
let dest = $(this).attr('href');
|
|
|
|
|
dest = parametre_url(dest, 'var_zajax', 'contenu');
|
|
|
|
@ -103,5 +99,4 @@ $(function() {
|
|
|
|
|
$content.html(data).addClass('objetblock__content--edit');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|