Bugzilla – Attachment 69164 Details for
Bug 19628
Move course reserves templates JS to the footer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19628: Move course reserves templates JS to the footer
Bug-19628-Move-course-reserves-templates-JS-to-the.patch (text/plain), 10.99 KB, created by
Owen Leonard
on 2017-11-15 16:10:56 UTC
(
hide
)
Description:
Bug 19628: Move course reserves templates JS to the footer
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2017-11-15 16:10:56 UTC
Size:
10.99 KB
patch
obsolete
>From 320354b3d9600790f4bf67e568442e5c09f7d7b6 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 15 Nov 2017 16:08:57 +0000 >Subject: [PATCH] Bug 19628: Move course reserves templates JS to the footer > >This patch modifies the staff client course reserves templates so that >JavaScript is included in the footer instead of the header. > >To test, apply the patch and test the JavaScript-driven features of >each page: All button controls, DataTables, autocomplete, etc. >--- > .../en/modules/course_reserves/course-details.tt | 80 ++++++++-------- > .../en/modules/course_reserves/course-reserves.tt | 21 +++-- > .../prog/en/modules/course_reserves/course.tt | 105 ++++++++++----------- > 3 files changed, 103 insertions(+), 103 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt >index 29f0132..1d433e8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt >@@ -1,51 +1,12 @@ > [% USE AuthorisedValues %] > [% USE ItemTypes %] > [% USE Branches %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Course reserves › Course details for [% course.course_name %]</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"> >-//<![CDATA[ >- $(document).ready(function(){ >- $("#course_reserves_table").dataTable($.extend(true, {}, dataTablesDefaults, { >- "sPaginationType": "four_button", >- "aoColumnDefs": [ >- { 'bSortable': false, 'aTargets': [ 'NoSort' ] }, >- { 'sType': "anti-the", 'aTargets' : [ 'antithe'] } >- ] >- })); >- >- $(".delete_item").click(function(){ >- return confirmDelete(_("Are you sure you want to remove this item from the course?")); >- }); >- >- $("#delete_course").click(function(){ >- [% SET count = course_reserves.size %] >- [% IF count == 1 %] >- return confirmDelete(_("Are you sure you want to delete this course? There is [% count %] attached item.") ); >- [% ELSIF count > 1 %] >- return confirmDelete(_("Are you sure you want to delete this course? There are [% count %] attached items.") ); >- [% ELSE %] >- return confirmDelete(_("Are you sure you want to delete this course?")); >- [% END %] >- }); >- $(".disabled").tooltip().on("click", function(e){ >- e.preventDefault(); >- if( $(this).hasClass("checkedout") ){ >- alert(_("This item cannot be removed. It is checked out")); >- } >- if( $(this).hasClass("itemlost") ) { >- alert(_("This item cannot be removed. It is lost")); >- } >- }); >- }); >- >-//]]> >-</script> >- > </head> > > <body id="courses_course_details" class="course"> >@@ -233,4 +194,43 @@ > </div> > </div> > >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript"> >+ $(document).ready(function(){ >+ $("#course_reserves_table").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "sPaginationType": "four_button", >+ "aoColumnDefs": [ >+ { 'bSortable': false, 'aTargets': [ 'NoSort' ] }, >+ { 'sType': "anti-the", 'aTargets' : [ 'antithe'] } >+ ] >+ })); >+ >+ $(".delete_item").click(function(){ >+ return confirmDelete(_("Are you sure you want to remove this item from the course?")); >+ }); >+ >+ $("#delete_course").click(function(){ >+ [% SET count = course_reserves.size %] >+ [% IF count == 1 %] >+ return confirmDelete(_("Are you sure you want to delete this course? There is [% count %] attached item.") ); >+ [% ELSIF count > 1 %] >+ return confirmDelete(_("Are you sure you want to delete this course? There are [% count %] attached items.") ); >+ [% ELSE %] >+ return confirmDelete(_("Are you sure you want to delete this course?")); >+ [% END %] >+ }); >+ $(".disabled").tooltip().on("click", function(e){ >+ e.preventDefault(); >+ if( $(this).hasClass("checkedout") ){ >+ alert(_("This item cannot be removed. It is checked out")); >+ } >+ if( $(this).hasClass("itemlost") ) { >+ alert(_("This item cannot be removed. It is lost")); >+ } >+ }); >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt >index 97c2f65..8abc0b0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt >@@ -1,19 +1,12 @@ > [% USE AuthorisedValues %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Course reserves</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" id="js"> >-$(document).ready(function() { >- $("#course_reserves_table").dataTable($.extend(true, {}, dataTablesDefaults, { >- "sPaginationType": "four_button" >- })); >-}); >-</script> >- > </head> >+ > <body id="courses_course_reserves" class="course"> > > [% INCLUDE 'header.inc' %] >@@ -106,5 +99,15 @@ $(document).ready(function() { > </div> > </div> > >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" id="js"> >+ $(document).ready(function() { >+ $("#course_reserves_table").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "sPaginationType": "four_button" >+ })); >+ }); >+ </script> >+[% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >index 1a3e01e..78dad2c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >@@ -1,60 +1,7 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Course reserves › [% IF course_name %] Edit [% course_name %] [% ELSE %] New course [% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] >- >-[% IF ( departments ) %] >- >- <script type="text/javascript"> >- //<![CDATA[ >- $(document).ready(function(){ >- $( "#find_instructor" ).autocomplete({ >- source: "/cgi-bin/koha/circ/ysearch.pl", >- minLength: 3, >- select: function( event, ui ) { >- AddInstructor( ui.item.surname + ", " + ui.item.firstname, ui.item.cardnumber ); >- 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.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >- .appendTo( ul ); >- }; >- >- if ( ! $('#instructors').html() ) { >- $('#course_instructors').hide(); >- } >- >- $("body").on("click",".removeInstructor",function(e){ >- e.preventDefault(); >- var divid = $(this).parent().attr("id"); >- var cardnumber = divid.replace("borrower_",""); >- RemoveInstructor(cardnumber); >- }); >- }); >- >- function AddInstructor( name, cardnumber ) { >- div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='#' class='removeInstructor'> " + _("Remove")+ " </a> ) <input type='hidden' name='instructors' value='" + cardnumber + "' /></div>"; >- $('#instructors').append( div ); >- >- $('#find_instructor').val('').focus(); >- $('#course_instructors').show(); >- } >- >- function RemoveInstructor( cardnumber ) { >- $( '#borrower_' + cardnumber ).remove(); >- >- if ( ! $('#instructors').html() ) { >- $('#course_instructors').hide( 800 ); >- } >- } >- >- //]]> >- </script> >- >-[% END %] >- > </head> > > <body id="courses_course" class="course"> >@@ -188,4 +135,54 @@ > > [% END %] > >+[% IF ( departments ) %] >+ [% MACRO jsinclude BLOCK %] >+ <script type="text/javascript"> >+ $(document).ready(function(){ >+ $( "#find_instructor" ).autocomplete({ >+ source: "/cgi-bin/koha/circ/ysearch.pl", >+ minLength: 3, >+ select: function( event, ui ) { >+ AddInstructor( ui.item.surname + ", " + ui.item.firstname, ui.item.cardnumber ); >+ 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.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >+ .appendTo( ul ); >+ }; >+ >+ if ( ! $('#instructors').html() ) { >+ $('#course_instructors').hide(); >+ } >+ >+ $("body").on("click",".removeInstructor",function(e){ >+ e.preventDefault(); >+ var divid = $(this).parent().attr("id"); >+ var cardnumber = divid.replace("borrower_",""); >+ RemoveInstructor(cardnumber); >+ }); >+ }); >+ >+ function AddInstructor( name, cardnumber ) { >+ div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='#' class='removeInstructor'> " + _("Remove")+ " </a> ) <input type='hidden' name='instructors' value='" + cardnumber + "' /></div>"; >+ $('#instructors').append( div ); >+ >+ $('#find_instructor').val('').focus(); >+ $('#course_instructors').show(); >+ } >+ >+ function RemoveInstructor( cardnumber ) { >+ $( '#borrower_' + cardnumber ).remove(); >+ >+ if ( ! $('#instructors').html() ) { >+ $('#course_instructors').hide( 800 ); >+ } >+ } >+ </script> >+ [% END %] >+[% END %] >+ > [% 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 19628
:
69164
|
69270
|
69595