From 058b3a6b6be84ea5e1784fe200d38f69c39b807e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Fri, 5 Apr 2019 19:31:41 +0200 Subject: [PATCH] Added search function to the 3 main trees too. --- assets/ts_src/ajax_ui.ts | 12 ++ .../AdminPages/EntityAdminBase.html.twig | 2 +- templates/base.html.twig | 136 ++++++++++-------- 3 files changed, 90 insertions(+), 60 deletions(-) diff --git a/assets/ts_src/ajax_ui.ts b/assets/ts_src/ajax_ui.ts index afc562fb..a2e4d913 100644 --- a/assets/ts_src/ajax_ui.ts +++ b/assets/ts_src/ajax_ui.ts @@ -211,6 +211,8 @@ class AjaxUI { enableLinks: false, showIcon: false, showBorder: true, + searchResultBackColor: '#ffc107', + searchResultColor: '#000', onNodeSelected: function(event, data) { if(data.href) { ajaxUI.navigateTo(data.href); @@ -220,6 +222,16 @@ class AjaxUI { expandIcon: "fas fa-plus fa-fw fa-treeview", collapseIcon: "fas fa-minus fa-fw fa-treeview"}) .on('initialized', function() { $(this).treeview('collapseAll', { silent: true }); + + //Implement searching if needed. + if($(this).data('treeSearch')) { + let _this = this; + let $search = $($(this).data('treeSearch')); + $search.on( 'input', function() { + $(_this).treeview('collapseAll', { silent: true }); + $(_this).treeview('search', [$search.val()]); + }); + } }); }); } diff --git a/templates/AdminPages/EntityAdminBase.html.twig b/templates/AdminPages/EntityAdminBase.html.twig index 9cceaf04..9762a519 100644 --- a/templates/AdminPages/EntityAdminBase.html.twig +++ b/templates/AdminPages/EntityAdminBase.html.twig @@ -6,7 +6,7 @@
- +
- + -
+ +
  • -
  • -
  • @@ -262,7 +280,7 @@
    - + {# Back to top buton #}