Bugzilla – Attachment 69563 Details for
Bug 19656
Move rotating collections templates JS to the footer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19656: Move rotating collections templates JS to the footer
Bug-19656-Move-rotating-collections-templates-JS-t.patch (text/plain), 10.37 KB, created by
Josef Moravec
on 2017-12-06 16:17:40 UTC
(
hide
)
Description:
Bug 19656: Move rotating collections templates JS to the footer
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2017-12-06 16:17:40 UTC
Size:
10.37 KB
patch
obsolete
>From e7e5dde3851b54d2cd9eefd7dc279a9a9b5b4d11 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 20 Nov 2017 16:41:33 +0000 >Subject: [PATCH] Bug 19656: Move rotating collections templates JS to the > footer > >This patch modifies the staff client's rotating collections templates so >that JavaScript is included in the footer instead of the header. > >The patch moves JavaScript from each template and the rotating >collections toolbar into a single external JavaScript file. > >To test, apply the patch and test the JavaScript-driven features of >each page: All button controls, DataTables functionality, form >validation, etc. > >Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > .../en/includes/rotating-collections-toolbar.inc | 46 ++++++++-------------- > .../en/modules/rotating_collections/addItems.tt | 15 +++---- > .../rotating_collections/editCollections.tt | 7 ++++ > .../rotating_collections/rotatingCollections.tt | 30 +++++--------- > .../rotating_collections/transferCollection.tt | 7 ++++ > .../intranet-tmpl/prog/js/rotating-collections.js | 27 +++++++++++++ > 6 files changed, 74 insertions(+), 58 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/rotating-collections-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/rotating-collections-toolbar.inc >index 9dd3e7a..f46f9f2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/rotating-collections-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/rotating-collections-toolbar.inc >@@ -1,31 +1,17 @@ >-<script type="text/javascript"> >- $(document).ready(function(){ >- $(".confirmdelete").click(function(){ >- $(this).parents('tr').addClass("warn"); >- if(confirm(_("Are you sure you want to delete this rotating collection?"))){ >- return true; >- } else { >- $(this).parents('tr').removeClass("warn"); >- return false; >- } >- }); >-}); >-</script> >+<div id="toolbar" class="btn-toolbar"> >+ <div class="btn-group"> >+ <a class="btn btn-default btn-sm" href="/cgi-bin/koha/rotating_collections/editCollections.pl?action=new"><i class="fa fa-plus"></i> New collection</a> >+ </div> > >- <div id="toolbar" class="btn-toolbar"> >- <div class="btn-group"> >- <a class="btn btn-default btn-sm" href="/cgi-bin/koha/rotating_collections/editCollections.pl?action=new"><i class="fa fa-plus"></i> New collection</a> >- </div> >- >- [% IF ( colId ) %] >- <div class="btn-group"> >- <a class="btn btn-default btn-sm" href="/cgi-bin/koha/rotating_collections/transferCollection.pl?colId=[% colId %]"><i class="fa fa-exchange"></i> Transfer</a> >- </div> >- <div class="btn-group"> >- <a class="btn btn-default btn-sm" href="/cgi-bin/koha/rotating_collections/editCollections.pl?action=edit&colId=[% colId %]"><i class="fa fa-pencil"></i> Edit</a> >- </div> >- <div class="btn-group"> >- <a class="btn btn-default btn-sm confirmdelete" href="/cgi-bin/koha/rotating_collections/editCollections.pl?action=delete&colId=[% colId %]"><i class="fa fa-trash"></i> Delete</a> >- </div> >- [% END %] >- </div> >+ [% IF ( colId ) %] >+ <div class="btn-group"> >+ <a class="btn btn-default btn-sm" href="/cgi-bin/koha/rotating_collections/transferCollection.pl?colId=[% colId %]"><i class="fa fa-exchange"></i> Transfer</a> >+ </div> >+ <div class="btn-group"> >+ <a class="btn btn-default btn-sm" href="/cgi-bin/koha/rotating_collections/editCollections.pl?action=edit&colId=[% colId %]"><i class="fa fa-pencil"></i> Edit</a> >+ </div> >+ <div class="btn-group"> >+ <a class="btn btn-default btn-sm confirmdelete" href="/cgi-bin/koha/rotating_collections/editCollections.pl?action=delete&colId=[% colId %]"><i class="fa fa-trash"></i> Delete</a> >+ </div> >+ [% END %] >+</div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt >index 43d4a8b..c7bf918 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt >@@ -1,14 +1,9 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Rotating collections › Collection [% colTitle %] ’ Add or remove items</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript"> >- //<![CDATA[ >- $( document ).ready(function() { >- $("#barcode").focus(); >- }); >- //]]> >-</script> > </head> >+ > <body id="rcoll_addItems" class="tools rcoll"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] >@@ -124,4 +119,10 @@ > [% INCLUDE 'tools-menu.inc' %] > </div> > </div> <!-- /#bd --> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/rotating-collections.js"></script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt >index 9504b61..cb0e729 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt >@@ -1,3 +1,4 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Rotating collections › > [%- IF ( action == "new" ) %] >@@ -134,4 +135,10 @@ > [% INCLUDE 'tools-menu.inc' %] > </div> > </div> <!-- /#bd --> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/rotating-collections.js"></script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt >index 7cf35f7..3564235 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt >@@ -1,30 +1,11 @@ > [% USE Branches %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Rotating collections</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"> >- $(document).ready(function(){ >- $(".confirmdelete").click(function(){ >- $(this).parents('tr').addClass("warn"); >- if(confirm(_("Are you sure you want to delete this collection?"))){ >- return true; >- } else { >- $(this).parents('tr').removeClass("warn"); >- return false; >- } >- }); >- $('#rotating-collections-table').dataTable($.extend(true, {}, dataTablesDefaults, { >- "autoWidth": false, >- "aoColumnDefs": [ >- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >- ], >- "sPaginationType": "four_button" >- } )); >- }); >-</script> > </head> >+ > <body id="rcoll_rotatingCollections" class="tools rcoll"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] >@@ -83,4 +64,11 @@ > [% INCLUDE 'tools-menu.inc' %] > </div> > </div> <!-- /#bd --> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/rotating-collections.js"></script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tt >index 43f76a4..7d457b8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tt >@@ -1,4 +1,5 @@ > [% USE Branches %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Rotating collections › Transfer collection</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -56,4 +57,10 @@ > [% INCLUDE 'tools-menu.inc' %] > </div> > </div> <!-- /#bd --> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script> >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/rotating-collections.js"></script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js b/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js >new file mode 100644 >index 0000000..bed5e9a >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js >@@ -0,0 +1,27 @@ >+/* global _ dataTablesDefaults */ >+ >+$(document).ready(function(){ >+ $("#barcode").focus(); >+ >+ $(".confirmdelete").click(function(){ >+ $(this).parents('tr').addClass("warn"); >+ if(confirm(_("Are you sure you want to delete this rotating collection?"))){ >+ return true; >+ } else { >+ $(this).parents('tr').removeClass("warn"); >+ return false; >+ } >+ }); >+ >+ if( $('#rotating-collections-table').length > 0 ){ >+ $('#rotating-collections-table').dataTable($.extend(true, {}, dataTablesDefaults, { >+ "autoWidth": false, >+ "aoColumnDefs": [ >+ { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >+ ], >+ "sPaginationType": "four_button" >+ } )); >+ } >+ >+ >+}); >-- >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 19656
:
69237
|
69505
| 69563 |
69564