From 413d5839fc5a7e466f5ec294f689c2c4b6a94a82 Mon Sep 17 00:00:00 2001 From: Matthieu Leproux Date: Wed, 6 Apr 2022 15:35:39 +0200 Subject: [PATCH] related to #1690 bug fix for cat openning not working after cat creation Previously when creating an album and a sub album to this album, the new parent open/close toggler woud not work --- admin/themes/default/js/albums.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/admin/themes/default/js/albums.js b/admin/themes/default/js/albums.js index 8f5c9d7da..dc619e95f 100644 --- a/admin/themes/default/js/albums.js +++ b/admin/themes/default/js/albums.js @@ -345,6 +345,21 @@ $(document).ready(() => { triggerDeleteAlbum($(this).data("id")); }); + $("#cat-"+parent_node.id).on( 'click', '.move-cat-toogler', function(e) { + var node_id = parent_node.id; + var node = $('.tree').tree('getNodeById', node_id); + if (node) { + open_nodes = $('.tree').tree('getState').open_nodes; + if (!open_nodes.includes(node_id)) { + $(this).html(toggler_open); + $('.tree').tree('openNode', node); + } else { + $(this).html(toggler_close); + $('.tree').tree('closeNode', node); + } + } + }); + goToNode($(".tree").tree('getNodeById', data.result.id), $(".tree").tree('getNodeById', data.result.id)); $('html,body').animate({ scrollTop: $("#cat-" + data.result.id).offset().top - screen.height / 2}, @@ -607,6 +622,14 @@ function applyMove(event) { $('.waiting-message').removeClass('visible'); setSubcatsBadge(previous_parent); setSubcatsBadge($('.tree').tree('getNodeById', moveParent)); + + $(".move-cat-add").unbind("click").on("click", function () { + openAddAlbumPopIn(); + $(".AddAlbumSubmit").data("a-parent", $(this).data("aid")); + }); + $(".move-cat-delete").on("click", function () { + triggerDeleteAlbum($(this).data("id")); + }); }) .catch((message) => console.log('An error has occured : ' + message )); }