Bugzilla – Attachment 56115 Details for
Bug 17418
Move staff client home page JavaScript to the footer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17418 - Move staff client home page JavaScript to the footer
Bug-17418---Move-staff-client-home-page-JavaScript.patch (text/plain), 7.57 KB, created by
Owen Leonard
on 2016-10-10 14:13:58 UTC
(
hide
)
Description:
Bug 17418 - Move staff client home page JavaScript to the footer
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2016-10-10 14:13:58 UTC
Size:
7.57 KB
patch
obsolete
>From b3e5d6a8cb126839c32f8ff1c68b0544793f1454 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 10 Oct 2016 05:52:51 -0400 >Subject: [PATCH] Bug 17418 - Move staff client home page JavaScript to the > footer >Content-Type: text/plain; charset="utf-8" > >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. >--- > .../prog/en/includes/doc-head-close.inc | 4 +++- > .../prog/en/includes/intranet-bottom.inc | 4 ++++ > .../intranet-tmpl/prog/en/includes/js_includes.inc | 25 ++++++++++++++++++++++ > .../prog/en/includes/patron-search-box.inc | 23 +------------------- > .../intranet-tmpl/prog/en/modules/intranet-main.tt | 24 +++++++++++---------- > 5 files changed, 46 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 fe89589..9340c9f 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 >@@ -22,4 +22,6 @@ > [% END %] > [% IF ( IntranetUserCSS ) %]<style type="text/css">[% IntranetUserCSS %]</style>[% 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 f9103ce..275bc43 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 %] > <span id="audio-alert"></span> >+ [% IF ( footerjs ) %] >+ [% INCLUDE js_includes.inc %] >+ [% jsinclude # Parse the page template's JavaScript block if necessary %] >+ [% END %] > </body> > </html> >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 fae3a0e..7a8c848 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >@@ -83,3 +83,28 @@ > }); > </script> > [% END %] >+ >+[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] >+ [% IF ( CircAutocompl ) %] >+ <script type="text/javascript"> >+ $(document).ready(function(){ >+ $( "#findborrower" ).autocomplete({ >+ source: "/cgi-bin/koha/circ/ysearch.pl", >+ minLength: 3, >+ select: function( event, ui ) { >+ $( "#findborrower" ).val( ui.item.cardnumber ); >+ $("#patronsearch").submit(); >+ return false; >+ } >+ }) >+ .data( "ui-autocomplete" )._renderItem = function( ul, item ) { >+ return $( "<li></li>" ) >+ .data( "ui-autocomplete-item", item ) >+ .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >+ .appendTo( ul ); >+ }; >+ }); >+ </script> >+ [% 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 1980318..cb13280 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 ) %]<script type="text/javascript"> >-//<![CDATA[ >-$(document).ready(function(){ >- $( "#findborrower" ).autocomplete({ >- source: "/cgi-bin/koha/circ/ysearch.pl", >- minLength: 3, >- select: function( event, ui ) { >- $( "#findborrower" ).val( ui.item.cardnumber ); >- $("#patronsearch").submit(); >- return false; >- } >- }) >- .data( "ui-autocomplete" )._renderItem = function( ul, item ) { >- return $( "<li></li>" ) >- .data( "ui-autocomplete-item", item ) >- .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >- .appendTo( ul ); >- }; >- >-}); >-//]]> >-</script>[% END %] >+[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] > <div id="circ_search" class="residentsearch"> > <p class="tip">Enter patron card number or partial name:</p> > <form action="/cgi-bin/koha/circ/circulation.pl" id="patronsearch" method="post"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >index b251d9b..a30214a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >@@ -1,19 +1,9 @@ > [% USE Koha %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha staff client</title> > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/mainpage.css" /> > [% INCLUDE 'doc-head-close.inc' %] >-<style type="text/css"> </style> >-<script type="text/javascript"> >-//<![CDATA[ >-var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this news item? This cannot be undone."); >- $(document).ready(function(){ >- $(".news_delete").on("click", function(){ >- return confirmDelete(MSG_CONFIRM_DELETE); >- }); >- }); >-//]]> >-</script> > </head> > <body id="main_intranet-main" class="main"> > [% INCLUDE 'header.inc' %] >@@ -200,5 +190,17 @@ var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this news item? This > </div> > </div> > >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript"> >+ //<![CDATA[ >+ var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this news item? This cannot be undone."); >+ $(document).ready(function(){ >+ $(".news_delete").on("click", function(){ >+ return confirmDelete(MSG_CONFIRM_DELETE); >+ }); >+ }); >+ //]]> >+ </script> >+[% END %] > <!-- the main div is closed in intranet-bottom.inc --> > [% INCLUDE 'intranet-bottom.inc' %] >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17418
:
56115
|
56164
|
57723