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

@ -508,6 +508,11 @@ span.highlight {
line-height: 1.428;
}
.treeview-sm .list-group-item {
padding-top: 3px;
padding-bottom: 3px;
}
/*****************************
* Pagination bar
*****************************/

View file

@ -24,7 +24,7 @@ import 'datatables.net-select-bs4/css/select.bootstrap4.css'
import 'bootstrap-select/dist/css/bootstrap-select.css'
import 'awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css'
import "bootstrap-treeview/src/css/bootstrap-treeview.css"
import "patternfly-bootstrap-treeview/src/css/bootstrap-treeview.css"
//require( 'jszip' );
//#require( 'pdfmake' );
@ -39,12 +39,11 @@ require( 'datatables.net-select-bs4' );
require('bootstrap-select');
require('jquery-form');
//require('bootstrap-treeview/src/js/bootstrap-treeview');
//Define jquery globally
window.$ = window.jQuery = require("jquery");
require('bootstrap-treeview/src/js/bootstrap-treeview');
require('patternfly-bootstrap-treeview/src/js/bootstrap-treeview')
require('./datatables.js');

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.