Bugzilla – Attachment 112594 Details for
Bug 26805
Remove remaining instances of jquery.checkboxes plugin from the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26805: Remove remaining instances of jquery.checkboxes plugin from the OPAC
Bug-26805-Remove-remaining-instances-of-jquerychec.patch (text/plain), 13.86 KB, created by
David Nind
on 2020-10-27 19:49:10 UTC
(
hide
)
Description:
Bug 26805: Remove remaining instances of jquery.checkboxes plugin from the OPAC
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-10-27 19:49:10 UTC
Size:
13.86 KB
patch
obsolete
>From 34e3c549c62ec2dde7d8ac624af30e3358327fd4 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 23 Oct 2020 18:14:34 +0000 >Subject: [PATCH] Bug 26805: Remove remaining instances of jquery.checkboxes > plugin from the OPAC > >This patch removes the use of the jquery.checkboxes plugin from the 5 >templates in the OPAC which still use it. The plugin itself is removed. > >To test, apply the patch and test the "Select all" and "Clear all" links >work to select and deselect checkboxes on the following pages: > >- The catalog search results page: The controls should also enable > and disable the "Select titles to..." menu. >- The list contents page: The controls should also enable > and disable the "Select titles to..." links. >- The suggestions page: The controls should also enable > and disable the "Select suggestions to..." link. >- The search history page: The controls should affect only the > corresponding table ("Current" or "Previous") and should enable and > disable the "Select searches to..." link. > >This patch also modifies the template for grouped search results, as >enabled by the OpacGroupResults system preference, but I don't know how >to test it. > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../bootstrap/en/modules/opac-results-grouped.tt | 13 ++++++------- > .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 17 ++++++++--------- > .../bootstrap/en/modules/opac-search-history.tt | 5 ++--- > .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 19 +++++++++---------- > .../bootstrap/en/modules/opac-suggestions.tt | 17 ++++++++--------- > .../lib/jquery/plugins/jquery.checkboxes.min.js | 13 ------------- > 6 files changed, 33 insertions(+), 51 deletions(-) > delete mode 100644 koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.checkboxes.min.js > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt >index afe486811d..c976070934 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt >@@ -290,7 +290,6 @@ > > [% INCLUDE 'opac-bottom.inc' %] > [% BLOCK jsinclude %] >- [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] > <script> > var q_array = new Array(); // will hold the search terms, if possible > $(document).ready(function(){ >@@ -331,13 +330,13 @@ > return false; > } > } >- $("#CheckAll").click(function(){ >- $("#bookbag_form").checkCheckboxes(); >- return false; >+ $("#CheckAll").on("click", function(e){ >+ e.preventDefault(); >+ $("#bookbag_form").find("input:checkbox").prop("checked", true); > }); >- $("#CheckNone").click(function(){ >- $("#bookbag_form").unCheckCheckboxes(); >- return false; >+ $("#CheckNone").on("click", function(e){ >+ e.preventDefault(); >+ $("#bookbag_form").find("input:checkbox").prop("checked", true); > }); > [% IF ( query_desc ) %] > var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') | html %]"; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >index b8d86ee9a7..1fd9010ef9 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >@@ -160,7 +160,7 @@ > [% IF ( total ) %] > > <div class="searchresults"> >- <form action="/cgi-bin/koha/opac-search.pl" method="get" name="bookbag_form" id="bookbag_form" class="checkboxed"> >+ <form action="/cgi-bin/koha/opac-search.pl" method="get" name="bookbag_form" id="bookbag_form"> > [% IF ( searchdesc ) %] > [% FOREACH QUERY_INPUT IN QUERY_INPUTS %] > <input type="hidden" name="[% QUERY_INPUT.input_name | html %]" value="[% QUERY_INPUT.input_value | html %]"/> >@@ -625,7 +625,6 @@ > [% END %] > [% IF ( OverDriveEnabled ) %][% Asset.js("js/overdrive.js") | $raw %][% END %] > [% IF ( RecordedBooksEnabled ) %][% Asset.js("js/recordedbooks.js") | $raw %][% END %] >- [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] > [% Asset.js("js/authtoresults.js") | $raw %] > [% Asset.js("lib/hc-sticky.js") | $raw %] > [% IF ( OpacHighlightedWords ) %] >@@ -710,7 +709,7 @@ > > function enableCheckboxActions(){ > // Enable/disable controls if checkboxes are checked >- var checkedBoxes = $(".checkboxed input:checkbox:checked"); >+ var checkedBoxes = $(".cb:checked"); > var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, #selections-toolbar .links label, #selections-toolbar .links button"); > if ($(checkedBoxes).size()) { > $("#selections").html(_("With selected titles: ")); >@@ -879,15 +878,15 @@ > return false; > } > } >- $("#CheckAll").click(function(){ >- $("#bookbag_form").checkCheckboxes(); >+ $("#CheckAll").on("click",function(e){ >+ e.preventDefault(); >+ $(".cb").prop("checked", true); > enableCheckboxActions(); >- return false; > }); >- $("#CheckNone").click(function(){ >- $("#bookbag_form").unCheckCheckboxes(); >+ $("#CheckNone").on("click",function(e){ >+ e.preventDefault(); >+ $(".cb").prop("checked", false); > enableCheckboxActions(); >- return false; > }); > > [% IF ( ( Koha.Preference( 'RequestOnOpac' ) == 1 ) && ( Koha.Preference( 'opacuserlogin' ) == 1 ) && DisplayMultiPlaceHold ) %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >index 5eb404b3cb..df8a53572d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >@@ -241,7 +241,6 @@ > [% INCLUDE 'opac-bottom.inc' %] > [% BLOCK jsinclude %] > [% INCLUDE 'datatables.inc' %] >-[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] > <script> > > var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete selected search history entries?"); >@@ -261,13 +260,13 @@ > $(".CheckNone").click(function(e){ > e.preventDefault(); > var form = $(this).parents("form").get(0); >- $(form).unCheckCheckboxes(); >+ $(form).find("input:checkbox").prop("checked", false); > enableCheckboxActions(form); > }); > $(".CheckAll").click(function(e){ > e.preventDefault(); > var form = $(this).parents("form").get(0); >- $(form).checkCheckboxes(); >+ $(form).find("input:checkbox").prop("checked", true); > enableCheckboxActions(form); > }); > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index 1ec6c10ab0..b819c1007b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -354,7 +354,7 @@ > </div> <!-- / #selections-toolbar --> > </div> <!-- /#floating --> > >- <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="myform" name="myform" class="checkboxed"> >+ <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="myform" name="myform"> > [% IF can_manage_shelf %] > <input type="hidden" name="op" value="remove_biblios" /> > <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" /> >@@ -804,7 +804,6 @@ > > [% INCLUDE 'opac-bottom.inc' %] > [% BLOCK jsinclude %] >-[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] > [% Asset.js("lib/hc-sticky.js") | $raw %] > [% IF OpenLibraryCovers || OpenLibrarySearch %] > [% Asset.js("js/openlibrary.js") | $raw %] >@@ -875,7 +874,7 @@ var MSG_CONFIRM_REMOVE_SHARE = _("Are you sure you want to remove this share?"); > > function enableCheckboxActions(){ > // Enable/disable controls if checkboxes are checked >- var checkedBoxes = $(".checkboxed input:checkbox:checked"); >+ var checkedBoxes = $(".cb:checked"); > if ($(checkedBoxes).size()) { > $("#selections").html(_("With selected titles: ")); > $("#selections-toolbar .links a").removeClass("disabled"); >@@ -899,15 +898,15 @@ $(function() { > }); > [% END %] > >- $("#CheckAll").click(function(){ >- $(".checkboxed").checkCheckboxes(); >+ $("#CheckAll").on("click",function(e){ >+ e.preventDefault(); >+ $(".cb").prop("checked", true); > enableCheckboxActions(); >- return false; > }); >- $("#CheckNone").click(function(){ >- $(".checkboxed").unCheckCheckboxes(); >+ $("#CheckNone").on("click",function(e){ >+ e.preventDefault(); >+ $(".cb").prop("checked", false); > enableCheckboxActions(); >- return false; > }); > > $(".cb").click(function(){ >@@ -967,7 +966,7 @@ $(function() { > }); > > $("#myform").submit(function(){ >- var checkedBoxes = $(".checkboxed input:checkbox:checked"); >+ var checkedBoxes = $(".cb:checked"); > var numchecked = $(checkedBoxes).size(); > if (numchecked) { > if( numchecked > 1 ){ >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >index 956a254805..c5d8ef650d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -337,7 +337,7 @@ > </div> > [% END %] > >- <table id="suggestt" class="checkboxed table table-bordered table-striped"> >+ <table id="suggestt" class="table table-bordered table-striped"> > <thead> > <tr> > [% IF ( loggedinusername ) %]<th> </th>[% END %] >@@ -465,13 +465,12 @@ > > [% INCLUDE 'opac-bottom.inc' %] > [% BLOCK jsinclude %] >-[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] > [% INCLUDE 'datatables.inc' %] > <script> > [% IF ( loggedinusername ) %] > function enableCheckboxActions(){ > // Enable/disable controls if checkboxes are checked >- var checkedBoxes = $(".checkboxed input:checkbox:checked"); >+ var checkedBoxes = $(".cb:checked"); > if ($(checkedBoxes).size()) { > $("#selections").html(_("With selected suggestions: ")); > $("#selections-toolbar .links a").removeClass("disabled"); >@@ -501,15 +500,15 @@ > })); > [% IF ( loggedinusername ) %]$("span.clearall").html("<a id=\"CheckNone\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Clear all")+"<\/a>"); > $("span.checkall").html("<a id=\"CheckAll\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Select all")+"<\/a>"); >- $("#CheckAll").click(function(){ >- $(".checkboxed").checkCheckboxes(); >+ $("#CheckAll").on("click",function(e){ >+ e.preventDefault(); >+ $(".cb").prop("checked", true); > enableCheckboxActions(); >- return false; > }); >- $("#CheckNone").click(function(){ >- $(".checkboxed").unCheckCheckboxes(); >+ $("#CheckNone").on("click",function(e){ >+ e.preventDefault(); >+ $(".cb").prop("checked", false); > enableCheckboxActions(); >- return false; > }); > $(".cb").click(function(){ > enableCheckboxActions(); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.checkboxes.min.js b/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.checkboxes.min.js >deleted file mode 100644 >index 8595324fa0..0000000000 >--- a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.checkboxes.min.js >+++ /dev/null >@@ -1,13 +0,0 @@ >-/* >- * >- * Copyright (c) 2006-2008 Sam Collett (http://www.texotela.co.uk) >- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) >- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. >- * >- * Version 2.1 >- * Demo: http://www.texotela.co.uk/code/jquery/checkboxes/ >- * >- * $LastChangedDate$ >- * $Rev$ >- */ >-;(function(d){d.fn.toggleCheckboxes=function(a,b){a=a||"*";b=b||false;var c=d([]);this.each(function(){var e=d("input[type=checkbox]",this).filter(a).each(function(){this.checked=!this.checked}).filter(":checked");c=e});if(!b){c=this}return c};d.fn.checkCheckboxes=function(a,b){a=a||"*";b=b||false;var c=d([]);this.each(function(){var e=d("input[type=checkbox]",this).filter(a).each(function(){this.checked=true}).filter(":checked");c=e});if(!b){c=this}return c};d.fn.unCheckCheckboxes=function(a,b){a=a||"*";b=b||false;var c=d([]);this.each(function(){var e=d("input[type=checkbox]",this).filter(a).each(function(){this.checked=false}).filter(":not(:checked)");c=e});if(!b){c=this}return c};d.radioCheckboxGroup=function(e,a){a=a||"*";var b="input[type=checkbox]";if(e){b+="[name="+e+"]"}var c=d(b).filter(a);c.click(function(){c.not(this).each(function(){this.checked=false}).end()})}})(jQuery); >\ No newline at end of file >-- >2.11.0
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 26805
:
112297
|
112308
|
112348
|
112349
|
112568
|
112594
|
112799