From e180c568affed09580ecf0f40737d1ec426fe2fa Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 10 Oct 2016 05:52:51 -0400 Subject: [PATCH] Bug 17418 - Move staff client home page JavaScript to the footer This patch alters the header and footer include files so that JavaScript can be included in either one or the other. As a proof of concept, the staff client home page is updated to include JS in the footer instead of the header. The processing of JavaScript included on individual pages can now be similar to how it is done in the OPAC. A block is created with the page's JavaScript which is then processed in js_includes.inc in the correct order, after other required js assets. On pages which have been modified to allow JavaScript to be moved to the footer you must add a variable to the template: [% SET footerjs = 1 %]. Eventually all staff client templates should be modified so that setting a flag is not required. "[% MACRO jsinclude BLOCK %]" is used instead of "[% BLOCK %]" and "[% PROCESS %]" because MACRO allows the template directives to be processed correctly when included by intranet-bottom.inc. To test, apply the patch and view the staff client home page. - Confirm that you get a confirmation when deleting a news item from the home page. - Enable the CircAutocompl system preference and test that patron autocomplete works from the "Check out" tab from the staff home page and from other pages where the "Check out" tab is present. - Test that JavaScript is working correctly on other pages like Circulation, Preferences, etc. Signed-off-by: Claire Gravely Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- .../prog/en/includes/doc-head-close.inc | 4 +++- .../prog/en/includes/intranet-bottom.inc | 4 ++++ .../prog/en/includes/js_includes.inc | 24 +++++++++++++++++++ .../prog/en/includes/patron-search-box.inc | 23 +----------------- .../prog/en/modules/intranet-main.tt | 24 ++++++++++--------- 5 files changed, 45 insertions(+), 34 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc index cd3919de38..2f8e9af267 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc @@ -21,4 +21,6 @@ [% END %] [% IF ( IntranetUserCSS ) %][% END %] -[% INCLUDE js_includes.inc %] +[% UNLESS ( footerjs ) %] + [% INCLUDE js_includes.inc %] +[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc index f9103ce41d..275bc43e4a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc @@ -66,5 +66,9 @@ [% END %] [% END %] + [% IF ( footerjs ) %] + [% INCLUDE js_includes.inc %] + [% jsinclude # Parse the page template's JavaScript block if necessary %] + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc index 141e53eff9..326f22a2d9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc @@ -84,3 +84,27 @@ }); [% END %] + +[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] + [% IF ( CircAutocompl ) %] + + [% END %] +[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc index 1980318b91..cb13280ba8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc @@ -1,25 +1,4 @@ -[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %][% IF ( CircAutocompl ) %][% END %] +[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] +[% MACRO jsinclude BLOCK %] + +[% END %] [% INCLUDE 'intranet-bottom.inc' %] -- 2.39.5