Skip to content

Commit

Permalink
feat(category): show parent label in back pseudo-item
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <[email protected]>
  • Loading branch information
btry committed Dec 2, 2021
1 parent f24d4e0 commit 893b2cc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ function updateCategoriesView() {
slinkyCategories = $('#plugin_formcreator_wizard_categories div:nth(2)').slinky({
label: true
});

// Show label of parent in the 'back' item
document.querySelectorAll('#plugin_formcreator_wizard_categories .slinky-menu a.back').forEach(item => {
var parentLabel = item.closest('ul').closest('li').querySelector('a').innerText;
item.innerText = parentLabel;
});

$('#plugin_formcreator_wizard_categories a.back').on('click',
function(event) {
var parentItem = $(event.target).parentsUntil('#plugin_formcreator_wizard_categories .slinky-menu > ul', 'li')[1];
Expand Down

0 comments on commit 893b2cc

Please sign in to comment.