Bugzilla – Attachment 69556 Details for
Bug 19647
Move patron lists templates JS to the footer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19647: Move patron lists templates JS to the footer
Bug-19647-Move-patron-lists-templates-JS-to-the-fo.patch (text/plain), 14.38 KB, created by
Josef Moravec
on 2017-12-06 14:49:02 UTC
(
hide
)
Description:
Bug 19647: Move patron lists templates JS to the footer
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2017-12-06 14:49:02 UTC
Size:
14.38 KB
patch
obsolete
>From 7476c82e9e5b59c5c34b1737d70b186c29b22667 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >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 <dominic@inlibro.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > .../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 @@ >-<script type="text/javascript">//<![CDATA[ >- $(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'); >- } >- }); >-//]]> >-</script> > <div id="navmenu"> > <div id="navmenulist"> > <ul> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt >index 6f8408d..f094a61 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt >@@ -1,3 +1,4 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Patron lists › > [% IF list.patron_list_id %] >@@ -63,4 +64,8 @@ > </form> > </div> > >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt >index c06997a..e0092fb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt >@@ -1,69 +1,10 @@ > [% USE KohaDates %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Patron lists › [% list.name %] › Add patrons</title> > [% INCLUDE 'doc-head-close.inc' %] > > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >- >-<script type="text/javascript" src="[% interface %]/js/autocomplete/patrons.js"></script> >-<script type="text/javascript"> >-//<![CDATA[ >-var MSG_REMOVE_PATRON = _("Remove"); >-$(document).ready(function() { >- $('#patrons_to_add_fieldset').hide(); >- >- $('#patron-list-table').dataTable($.extend(true, {}, dataTablesDefaults, { >- "order": [[ 3, "asc" ]], >- "aoColumns": [ >- null,null,null,null,null,null,null,{ "sType": "title-string" },null >- ], >- "aoColumnDefs": [ >- { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, >- ], >- "sPaginationType": "four_button" >- } )); >- >- patron_autocomplete({ >- patron_container: $("#patrons_to_add"), >- input_autocomplete: $("#find_patron"), >- patron_input_name: 'patrons_to_add' >- }); >- >- var checkBoxes = $("input[type='checkbox']","#patron-list-table"); >- >- $("#CheckAll").click(function(e){ >- e.preventDefault(); >- checkBoxes.each(function(){ >- $(this).prop("checked",1); >- }); >- }); >- $("#CheckNone").click(function(e){ >- e.preventDefault(); >- checkBoxes.each(function(){ >- $(this).prop("checked",0); >- }); >- }); >- >- $("#remove_patrons").submit(function(){ >- var checkedItems = $("input:checked"); >- if ($(checkedItems).size() == 0) { >- alert(_("You must select one or more patrons to remove")); >- return false; >- } >- $(checkedItems).parents('tr').addClass("warn"); >- if( confirm(_("Are you sure you want to remove the selected patrons?")) ) { >- return true; >- } else { >- $(checkedItems).parents('tr').removeClass("warn"); >- return false; >- } >- }); >-}); >- >-//]]> >-</script> >- > </head> > > <body id="patlist_list" class="pat patlist"> >@@ -161,4 +102,65 @@ $(document).ready(function() { > [% INCLUDE 'tools-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ [% INCLUDE 'datatables.inc' %] >+ >+ <script type="text/javascript" src="[% interface %]/js/autocomplete/patrons.js"></script> >+ <script type="text/javascript"> >+ var MSG_REMOVE_PATRON = _("Remove"); >+ $(document).ready(function() { >+ $('#patrons_to_add_fieldset').hide(); >+ >+ $('#patron-list-table').dataTable($.extend(true, {}, dataTablesDefaults, { >+ "order": [[ 3, "asc" ]], >+ "aoColumns": [ >+ null,null,null,null,null,null,null,{ "sType": "title-string" },null >+ ], >+ "aoColumnDefs": [ >+ { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, >+ ], >+ "sPaginationType": "four_button" >+ } )); >+ >+ patron_autocomplete({ >+ patron_container: $("#patrons_to_add"), >+ input_autocomplete: $("#find_patron"), >+ patron_input_name: 'patrons_to_add' >+ }); >+ >+ var checkBoxes = $("input[type='checkbox']","#patron-list-table"); >+ >+ $("#CheckAll").click(function(e){ >+ e.preventDefault(); >+ checkBoxes.each(function(){ >+ $(this).prop("checked",1); >+ }); >+ }); >+ $("#CheckNone").click(function(e){ >+ e.preventDefault(); >+ checkBoxes.each(function(){ >+ $(this).prop("checked",0); >+ }); >+ }); >+ >+ $("#remove_patrons").submit(function(){ >+ var checkedItems = $("input:checked"); >+ if ($(checkedItems).size() == 0) { >+ alert(_("You must select one or more patrons to remove")); >+ return false; >+ } >+ $(checkedItems).parents('tr').addClass("warn"); >+ if( confirm(_("Are you sure you want to remove the selected patrons?")) ) { >+ return true; >+ } else { >+ $(checkedItems).parents('tr').removeClass("warn"); >+ return false; >+ } >+ }); >+ }); >+ </script> >+[% 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' %] > <title>Koha › Tools › Patron lists</title> > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'greybox.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >- >-<script type="text/javascript"> >-//<![CDATA[ >- $(document).ready(function() { >- var patronExportModal = $("#patronExportModal"); >- var patronExportModalBody = $("#patronExportModal .modal-body") >- >- $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, { >- "autoWidth": false, >- "aoColumnDefs": [ >- { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] } >- ], >- "sPaginationType": "four_button" >- } )); >- $(".delete_patron").on("click", function(){ >- $(".dropdown").removeClass("open"); >- var list = $(this).data("list-name"); >- return confirmDelete( _("Are you sure you want to delete the list %s?").format(list) ); >- }); >- >- $(".print_cards").on("click", function(e){ >- e.preventDefault(); >- var page = $(this).attr("href"); >- patronExportModalBody.load(page + " #exportingf"); >- patronExportModal.modal("show"); >- }); >- >- patronExportModal.on("hidden", function(){ >- patronExportModalBody.html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); >- }); >- >- patronExportModal.on("submit", "#exportingf", function(e){ >- e.preventDefault(); >- modal_body = patronExportModalBody; >- modal_body.html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); >- target_url = $(this).attr("action"); >- params = $( this ).serialize(); >- modal_body.load( target_url + "?" + params + " #custom-doc"); >- }); >- >- patronExportModal.on("click",".closebtn,.gb-close",function(e){ >- e.preventDefault(); >- patronExportModal.modal("hide"); >- }); >- >- }); >-//]]> >-</script> >- > </head> > > <body id="patlist_lists" class="pat patlist"> >@@ -151,4 +102,56 @@ > [% INCLUDE 'tools-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ [% INCLUDE 'datatables.inc' %] >+ >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ var patronExportModal = $("#patronExportModal"); >+ var patronExportModalBody = $("#patronExportModal .modal-body") >+ >+ $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, { >+ "autoWidth": false, >+ "aoColumnDefs": [ >+ { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] } >+ ], >+ "sPaginationType": "four_button" >+ } )); >+ $(".delete_patron").on("click", function(){ >+ $(".dropdown").removeClass("open"); >+ var list = $(this).data("list-name"); >+ return confirmDelete( _("Are you sure you want to delete the list %s?").format(list) ); >+ }); >+ >+ $(".print_cards").on("click", function(e){ >+ e.preventDefault(); >+ var page = $(this).attr("href"); >+ patronExportModalBody.load(page + " #exportingf"); >+ patronExportModal.modal("show"); >+ }); >+ >+ patronExportModal.on("hidden", function(){ >+ patronExportModalBody.html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); >+ }); >+ >+ patronExportModal.on("submit", "#exportingf", function(e){ >+ e.preventDefault(); >+ modal_body = patronExportModalBody; >+ modal_body.html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); >+ target_url = $(this).attr("action"); >+ params = $( this ).serialize(); >+ modal_body.load( target_url + "?" + params + " #custom-doc"); >+ }); >+ >+ patronExportModal.on("click",".closebtn,.gb-close",function(e){ >+ e.preventDefault(); >+ patronExportModal.modal("hide"); >+ }); >+ >+ }); >+ </script> >+[% 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
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 19647
:
69202
|
69211
| 69556