Browse Source

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>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Owen Leonard 11 months ago
committed by Jonathan Druart
parent
commit
8220aa14f9
  1. 13
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt
  2. 17
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
  3. 5
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt
  4. 19
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt
  5. 17
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt
  6. 13
      koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.checkboxes.min.js

13
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 %]";

17
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 ) %]

5
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);
});

19
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 ){

17
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>&nbsp;</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();

13
koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.checkboxes.min.js

@ -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);
Loading…
Cancel
Save