Show a treeview in the admin menus, to select between the different elements.

This commit is contained in:
Jan Böhmer 2019-04-05 17:49:02 +02:00
parent 928b574d8c
commit 650b388a1d
16 changed files with 269 additions and 25 deletions

View file

@ -217,7 +217,10 @@ class AjaxUI {
}
},
//onNodeContextmenu: contextmenu_handler,
expandIcon: "fas fa-plus fa-fw fa-treeview", collapseIcon: "fas fa-minus fa-fw fa-treeview"}).treeview('collapseAll', { silent: true });
expandIcon: "fas fa-plus fa-fw fa-treeview", collapseIcon: "fas fa-minus fa-fw fa-treeview"})
.on('initialized', function() {
$(this).treeview('collapseAll', { silent: true });
});
});
}

View file

@ -28,6 +28,8 @@
*
*/
import {ajaxUI} from "./ajax_ui";
/************************************
*
* In this file all the functions that has to be called using AjaxUIoperation are registered.
@ -123,10 +125,36 @@ $(document).on("ajaxUI:reload", function () {
$(document).on("ajaxUI:start ajaxUI:reload", function () {
$(".tooltip").remove();
$('a[title], button[title], span[title], h6[title]')
//@ts-ignore
//@ts-ignore
.tooltip("hide").tooltip({container: "body", placement: "auto", boundary: 'window'});
});
// Add bootstrap treeview on divs with data-tree-data attribute
$(document).on("ajaxUI:start ajaxUI:reload", function() {
$("[data-tree-data]").each(function(index, element) {
let data = $(element).data('treeData');
//@ts-ignore
$(element).treeview({
data: data,
enableLinks: false,
showIcon: false,
showBorder: true,
expandIcon: "fas fa-plus fa-fw fa-treeview", collapseIcon: "fas fa-minus fa-fw fa-treeview",
onNodeSelected: function(event, data) {
if(data.href) {
ajaxUI.navigateTo(data.href);
}
}
}).on('initialized', function() {
$(this).treeview('collapseAll', { silent: true });
let selected = $(this).treeview('getSelected');
$(this).treeview('revealNode', [ selected, {silent: true } ]);
});
});
});
/**
* Register the button, to jump to the top of the page.