From 1a9b8a00ae9c98545b8247c91b3c8b406c2ccf06 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 20 Nov 2017 18:05:14 +0000 Subject: [PATCH] Bug 19659: Move JS to the footer: Suggestions and tags This patch modifies the staff client's suggestions and tags templates so that JavaScript is included in the footer instead of the header. This patch adds a new JS file, acquisitions-menu.js, which will be added to each template which has the Acquisitions sidebar menu (in this case, suggestions). 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 suggestions and tags pages: All button controls, DataTables functionality, form validation, etc. Signed-off-by: Claire Gravely Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart --- .../prog/en/modules/suggestion/suggestion.tt | 356 +++++++++--------- .../prog/en/modules/tags/list.tt | 48 +-- .../prog/en/modules/tags/review.tt | 47 +-- .../prog/js/acquisitions-menu.js | 4 + 4 files changed, 237 insertions(+), 218 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/acquisitions-menu.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 5a8ada6ff0..f7e6fcc2f0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -2,6 +2,7 @@ [% USE AuthorisedValues %] [% USE KohaDates %] [% USE Price %] +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › [% IF ( op_save ) %] @@ -17,185 +18,17 @@ [% END %] [% INCLUDE 'doc-head-close.inc' %] -[% INCLUDE 'calendar.inc' %] -[% IF ( op == 'show' || op_else ) %] - -[% END %] [% IF ( op_else ) %] - -[% INCLUDE 'datatables.inc' %] - - -[% END %] -[% IF ( op_save ) %] - +[% IF ( op_else ) %] + [% END %] - + [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] @@ -912,5 +745,178 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o [% END %] [% END %] + +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'calendar.inc' %] + [% IF ( op == 'show' || op_else ) %] + + [% END %] + [% IF ( op_else ) %] + [% INCLUDE 'datatables.inc' %] + + + [% END %] + [% IF ( op_save ) %] + + [% END %] + + +[% END %] + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt index 798e252453..61fd45223d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt @@ -1,32 +1,12 @@ +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Tags › [% IF ( do_it ) %]Review › [% ELSE %]Review tags[% END %] [% INCLUDE 'doc-head-close.inc' %] -[% INCLUDE 'datatables.inc' %] - + [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] @@ -94,4 +74,28 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : + +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'datatables.inc' %] + +[% END %] + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt index ffb606df00..989b451431 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt @@ -1,28 +1,9 @@ [% USE KohaDates %] +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Home › Tools › Tags › [% IF ( do_it ) %]Review › [% ELSE %]Review tags[% END %] [% INCLUDE 'doc-head-close.inc' %] -[% INCLUDE 'datatables.inc' %] -[% INCLUDE 'calendar.inc' %] - - - + [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] @@ -239,5 +221,28 @@ tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; } -[% INCLUDE 'intranet-bottom.inc' %] +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'calendar.inc' %] + + + +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/acquisitions-menu.js b/koha-tmpl/intranet-tmpl/prog/js/acquisitions-menu.js new file mode 100644 index 0000000000..49786b9f08 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/acquisitions-menu.js @@ -0,0 +1,4 @@ +$(document).ready(function() { + var path = location.pathname.substring(1); + $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold'); +}); \ No newline at end of file -- 2.39.5