From 80063de4e1af96a6a806845e448dd493c9eccff6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 20 Jan 2014 11:36:33 +0100 Subject: [PATCH] [PASSED QA] Bug 7825: QA followup - preselection of items This patch changes the default behavior for the 'force' value. If the pref is set to force, no item is preselected and the item list is shown. Signed-off-by: Katrin Fischer --- .../opac-tmpl/prog/en/modules/opac-reserve.tt | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt index a19e640..1ea64d4 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -31,6 +31,11 @@ function select_first_available(id){ var copiesRowId = null; var wasSpecific = false; var lastCopiesRowId = null; + + $(".toggle-hold-options").show(); + $(".hold-options").hide(); + $(".holddatefrom,.holddateto").prop("readOnly", true); + $(".checkitem").parent().click(function(e){ if(e.target.tagName.toLowerCase() == 'td'){ $(this).find("input.checkitem").each( function() { @@ -49,6 +54,15 @@ function select_first_available(id){ } }); + $(".toggle-hold-options").on("click",function(e){ + e.preventDefault(); + toggleLink = $(this); + var optionsID = this.id.replace("toggle-hold-options-",""); + $("#hold-options-"+optionsID).toggle(0, function() { + toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options")); + }); + }); + // Hides all 'specific copy' table rows on load. $(".copiesrow").hide(); @@ -61,10 +75,6 @@ function select_first_available(id){ } }); - $(".toggle-hold-options").show(); - $(".hold-options").hide(); - $(".holddatefrom,.holddateto").prop("readOnly", true); - $(".date-format").each(function(){ if($(this).hasClass("to")){ var op = "to"; } if($(this).hasClass("from")){ var op = "from"; } @@ -117,8 +127,9 @@ function select_first_available(id){ $(".selectany").attr("checked", "checked"); [% END %] - // If we can choose a specific item, we preselect the first one - [% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %] + // If the user is *allowed* to choose a specific item + // The first one is preselected + [% IF OPACItemHolds =="1" %] $("table.copiesrow").each(function(){ var id = suffixOf($(this).attr("id"), "_"); select_first_available(id); @@ -202,17 +213,6 @@ function select_first_available(id){ $("#biblionumbers").val(biblionumbers); return true; }); - $(".toggle-hold-options").on("click",function(e){ - e.preventDefault(); - toggleLink = $(this); - var optionsID = this.id.replace("toggle-hold-options-",""); - $("#hold-options-"+optionsID).toggle(0, function() { - toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options")); - }); - }); - - - [% FOREACH bibitemloo IN bibitemloop %] @@ -485,6 +485,7 @@ function select_first_available(id){ [% IF OPACItemHolds == 'force' %] -- 1.8.3.2