From 7476c82e9e5b59c5c34b1737d70b186c29b22667 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 17 Nov 2017 16:32:56 +0000 Subject: [PATCH] Bug 19647: Move patron lists templates JS to the footer This patch modifies the staff client patron lists templates so that JavaScript is included in the footer instead of the header. This patch adds a new JS file, tools-menu.js, which will be added to each template which has the Tools sidebar menu. Highlighting of the current page in the sidebar menu will be broken for pages which have not been modified to use this file. To test, apply the patch and test the JavaScript-driven features of each modified template: All button controls, DataTables functionality, form validation, etc. resolved the issue, sorry about that, everything is working fine!Signed-off-by: Dominic Pichette Signed-off-by: Josef Moravec --- .../intranet-tmpl/prog/en/includes/tools-menu.inc | 17 --- .../prog/en/modules/patron_lists/add-modify.tt | 5 + .../prog/en/modules/patron_lists/list.tt | 122 +++++++++++---------- .../prog/en/modules/patron_lists/lists.tt | 103 ++++++++--------- koha-tmpl/intranet-tmpl/prog/js/tools-menu.js | 14 +++ 5 files changed, 134 insertions(+), 127 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/tools-menu.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc index d7b40cf..50e52f7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc @@ -1,20 +1,3 @@ - + +[% MACRO jsinclude BLOCK %] + + [% INCLUDE 'datatables.inc' %] + + + +[% END %] + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt index 9bdf4ab..e0b13ad 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt @@ -1,58 +1,9 @@ +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Patron lists [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'greybox.inc' %] -[% INCLUDE 'datatables.inc' %] - - - @@ -151,4 +102,56 @@ [% INCLUDE 'tools-menu.inc' %] + +[% MACRO jsinclude BLOCK %] + + [% INCLUDE 'datatables.inc' %] + + +[% END %] + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js b/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js new file mode 100644 index 0000000..6a73363 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js @@ -0,0 +1,14 @@ + $(document).ready(function() { + var path = location.pathname.substring(1); + if (path.indexOf("labels") >= 0 && path.indexOf("spine") < 0 ) { + $('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').css('font-weight','bold'); + } else if (path.indexOf("patroncards") >= 0 ) { + $('#navmenulist a[href$="/cgi-bin/koha/patroncards/home.pl"]').css('font-weight','bold'); + } else if (path.indexOf("patron_lists") >= 0 ) { + $('#navmenulist a[href$="/cgi-bin/koha/patron_lists/lists.pl"]').css('font-weight','bold'); + } else if ((path+location.search).indexOf("batchMod.pl?del=1") >= 0 ) { + $('#navmenulist a[href$="/cgi-bin/koha/tools/batchMod.pl?del=1"]').css('font-weight','bold'); + } else { + $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold'); + } + }); -- 2.1.4