From 69d68c9f191760a91cd60d907ad9eceeec84be90 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 20 Jan 2014 11:36:48 +0100 Subject: [PATCH] [PASSED QA] Bug 7825: QA followup - preselection of items (bootstrap) Signed-off-by: Katrin Fischer Passes all tests and QA script. Retested with all 3 themes, works as expected. --- .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 39 ++++++++++++---------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt index 0a23339..5e316a7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -411,6 +411,11 @@ 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() { @@ -429,12 +434,22 @@ } }); + $(".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(); - [% FOREACH bibitemloo IN bibitemloop %] - [% IF bibitemloo.holdable %] - [% IF OPACItemHolds == 'force' %] + [% IF OPACItemHolds == 'force' %] + [% FOREACH bibitemloo IN bibitemloop %] + [% IF bibitemloo.holdable %] + $("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); $("#copiesrow_[% bibitemloo.biblionumber %]").show(); [% END %] [% END %] @@ -449,10 +464,6 @@ } }); - $(".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"; } @@ -504,8 +515,9 @@ $(".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); @@ -591,15 +603,6 @@ 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 %] [% IF ( bibitemloo.holdable ) %] // http://jqueryui.com/demos/datepicker/#date-range -- 1.8.3.2