From 74553d7fef8ebd6059915478bf978596f620a975 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 21 Aug 2013 15:24:19 -0400 Subject: [PATCH] Bug 10836 - New layout for placing holds in the OPAC This patch changes the layout of the OPAC's place hold screen, eliminating the table in favor of a more flexible, open display. To test, place single and multiple holds under various conditions: - Items which are not available to be place on hold - With OpacHoldNotes on and off - With OPACItemHolds on and off - With OPACAllowHoldDateInFuture on and off - With IndependentBranches on and off - With JavaScript disabled Test setting hold notes, holding specific copies, and setting hold start dates. When setting a hold start date and hold expiration date, the two datepickers should work together to prevent invalid date combinations (dates after today, expiration dates which precede the start date). Signed-off-by: Julian Maurice Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 36 +- .../prog/en/includes/date-format.inc | 1 + .../opac-tmpl/prog/en/modules/opac-reserve.tt | 422 +++++++++--------- 3 files changed, 247 insertions(+), 212 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/date-format.inc diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index 0311bddac6..7d40ba9c9c 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -104,7 +104,7 @@ fieldset.rows li.radio { fieldset.rows li.radio label { float : none; width : auto; - margin : 0 0 0 1em; + margin : 0 .5em; } fieldset.rows ol.radio label { @@ -3016,15 +3016,6 @@ a.reviewlink,a.reviewlink:visited { float:left; padding: 0.1em 0; } -.notesrow label { - font-weight: bold; -} -.notesrow span { - display: block; -} -.notesrow textarea { - width: 100%; -} .thumbnail-shelfbrowser span { margin: 0px auto; @@ -3063,3 +3054,28 @@ padding: 0.1em 0; display: block; overflow: auto; } + +.holdrow { + clear : both; + padding:1em; + border-bottom:1px solid #CCC; + margin-bottom:.5em; +} +.holdrow fieldset { + border : 0; + margin : 0; +} +.hold-options { + clear : both; +} +.toggle-hold-options { + background-color: #eee; + clear : both; + display : block; + font-weight : bold; + margin: 1em 0; + padding: .5em; +} +.copiesrow { + clear : both; +} diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/date-format.inc b/koha-tmpl/opac-tmpl/prog/en/includes/date-format.inc new file mode 100644 index 0000000000..53dae716a8 --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/includes/date-format.inc @@ -0,0 +1 @@ +[% IF ( dateformat == "us" ) %](MM/DD/YYYY)[% ELSIF ( dateformat == "metric" ) %](DD/MM/YYYY)[% ELSE %](YYYY-MM-DD)[% END %] 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 d1fdbc6058..46005ed176 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -33,7 +33,6 @@ }); // Hides all 'specific copy' table rows on load. $(".copiesrow").hide(); - $(".notesrow").hide(); // Insert reasons for forced hold notes $(".forcenotesreason").each(function(){ @@ -44,22 +43,37 @@ } }); - $("#place_on_hdr").show(); - $(".place_on_type").show(); + $("#place_on_hdr,.place_on_type,.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"; } + var bibNum = $(this).data("biblionumber"); + $(this).html("" + _("Clear date") + ""); + }); + + $(".clear-date").on("click",function(e){ + e.preventDefault(); + var fieldID = this.id.replace("clear",""); + var op = $(this).data("op"); + $("#" + op + fieldID).val(""); + }); // Replace non-JS single-selection with multi-selection capability. $(".reserve_mode").val("multi"); $(".confirm_nonjs").remove(); $(".confirmjs_hold").each(function(){ var bib = $(this).attr("title"); - var html = ""; + var html = " "; $(this).html(html); }); $(".confirmjs_nohold").each(function(){ var bib = $(this).attr("title"); - var html = ""; + var html = ""; $(this).html(html); }); @@ -115,12 +129,6 @@ $(".copiesrow").hide(); }); - // Show or hide holds notes - $(".shownotes").click(function(){ - biblioNum = suffixOf($(this).attr("id"), "_"); - $("#notesrow_"+biblioNum).toggle(); - }); - // When 'Place Hold' button is clicked $(".placehold").click(function(){ var biblionumbers = ""; @@ -170,6 +178,43 @@ return true; }); + $(".toggle-hold-options").on("click",function(e){ + e.preventDefault(); + toggleLink = $(this); + var optionsID = this.id.replace("toggle-hold-options-",""); + var copiesRow = $("#copiesrow_"+optionsID) + $("#hold-options-"+optionsID).toggle(0, function() { + if( copiesRow.is(':visible') ){ + $("#reqany_"+optionsID).prop("checked",true); + copiesRow.hide(); + } + toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options")); + }); + }); + + + + + +[% FOREACH bibitemloo IN bibitemloop %] + [% IF ( bibitemloo.holdable ) %] + // http://jqueryui.com/demos/datepicker/#date-range + var dates[% bibitemloo.biblionumber %] = $( "#from[% bibitemloo.biblionumber %], #to[% bibitemloo.biblionumber %]" ).datepicker({ + minDate: 1, + changeMonth: true, + numberOfMonths: 1, + onSelect: function( selectedDate ) { + var option = this.id == "from[% bibitemloo.biblionumber %]" ? "minDate" : "maxDate", + instance = $( this ).data( "datepicker" ); + date = $.datepicker.parseDate( + instance.settings.dateFormat || + $.datepicker._defaults.dateFormat, + selectedDate, instance.settings ); + dates[% bibitemloo.biblionumber %].not( this ).datepicker( "option", option, date ); + } + }); + [% END %] +[% END %] }); // ]]> @@ -255,209 +300,181 @@
- - [% UNLESS ( none_available ) %] - - - [% UNLESS ( item_level_itypes ) %] - - [% END %] - [% IF showholds && showpriority %] - - [% ELSIF showholds %] - - [% ELSIF showpriority %] - - [% END %] - [% IF ( reserve_in_future ) %] - - [% END %] - - [% IF ( OpacHoldNotes ) %][% END %] - [% IF ( OPACItemHolds ) %] - - [% END %] - [% UNLESS ( singleBranchMode ) %] - [% IF ( choose_branch ) %] - - [% END %] - [% END %] - [% ELSE %][% END %] [% FOREACH bibitemloo IN bibitemloop %] - - [% IF ( bibitemloo.holdable ) %] - - [% ELSE %] - [% UNLESS ( none_available ) %][% END %] - [% END %] - [% IF ( bibitemloo.holdable ) %] - [% IF ( bibitemloo.holdable ) %] - - [% UNLESS ( item_level_itypes ) %] - + [% UNLESS ( singleBranchMode ) %] + [% IF ( bibitemloo.holdable ) %] + [% IF ( choose_branch ) %] +
  • + + [% UNLESS ( bibitemloo.holdable ) %] + + [% ELSE %] + + [% END %] +
  • + [% END %] + [% END %] + [% END %] + + +
    +
      + [% IF ( reserve_in_future ) %] +
    • + + [% INCLUDE 'date-format.inc' %] +
    • + [% END %] + + [% END %] + [% IF ( bibitemloo.holdable ) %] +
    • + + + [% INCLUDE 'date-format.inc' %] +
    • [% END %] - [% IF showholds || showpriority %] -
    + + [% IF ( OpacHoldNotes && bibitemloo.holdable ) %] +
  • +
    + + + + +
    +
  • [% END %] - [% IF ( reserve_in_future ) %] - [% END %] - - [% END %] - [% IF ( bibitemloo.holdable ) %][% END %] - - [% IF ( OpacHoldNotes ) %][% IF ( bibitemloo.holdable ) %][% END %][% END %] - - [% IF ( bibitemloo.holdable ) %] - - [% IF ( OPACItemHolds ) %] - - - [% END %][% END %] - - [% UNLESS ( singleBranchMode ) %] + [% IF ( bibitemloo.holdable ) %] - [% IF ( choose_branch ) %] - - [% END %] - [% END %] - [% END %] - + + [% IF ( OPACItemHolds ) %] + + +
  • + [% UNLESS ( bibitemloo.holdable ) %] + + [% ELSE %] + + [% END %] - [% IF ( OpacHoldNotes ) %] - [% IF ( bibitemloo.holdable ) %] -
  • - - - - [% END %] - [% END %] + + [% UNLESS ( bibitemloo.holdable ) %] + + [% ELSE %] + + [% END %] + + + [% END %] + [% END %] + + + +
    [% IF ( OPACItemHolds ) %] [% IF ( bibitemloo.holdable ) %] - - - - + + [% END %] + [% END %] [% END %] -
    HoldTitleItem typeHolds and priorityHoldsPriorityHold starts on dateHold not needed afterNotesPickup location
    Title
    - - - - - - - -  [% ELSE %][% END %] - [% bibitemloo.title |html %][% IF ( bibitemloo.subtitle ) %] [% FOREACH subtitl IN bibitemloo.subtitle %][% subtitl.subfield %][% END %][% END %] - [% IF ( bibitemloo.author ) %], by [% bibitemloo.author %][% END %] +
    - [% UNLESS ( bibitemloo.holdable ) %] +

    - [% IF ( bibitemloo.already_reserved ) %] -

    You have already requested this title.
    + [% IF ( bibitemloo.holdable ) %] + + + + + + + [% ELSE %] - [% UNLESS ( bibitemloo.bib_available ) %] -
    No available items.
    - [% ELSE %] - [% IF ( bibitemloo.already_patron_possession ) %] -
    This title cannot be requested because it's already in your possession.
    + [% END %] + + [% bibitemloo.title |html %][% IF ( bibitemloo.subtitle ) %] [% FOREACH subtitl IN bibitemloo.subtitle %][% subtitl.subfield %][% END %][% END %] + [% IF ( bibitemloo.author ) %], by [% bibitemloo.author %][% END %]

    + + + + + [% UNLESS ( bibitemloo.holdable ) %] + [% IF ( bibitemloo.already_reserved ) %] +
    You have already requested this title.
    [% ELSE %] -
    This title cannot be requested.
    + [% UNLESS ( bibitemloo.bib_available ) %] +
    No available items.
    + [% ELSE %] + [% IF ( bibitemloo.already_patron_possession ) %] +
    This title cannot be requested because it's already in your possession.
    + [% ELSE %] +
    This title cannot be requested.
    + [% END %] + [% END %] [% END %] - [% END %] [% END %] + [% IF ( bibitemloo.holdable ) %] +
    +
      + + [% UNLESS ( item_level_itypes ) %] +
    • + Item type: + [% IF ( bibitemloo.imageurl ) %][% END %] + [% bibitemloo.description %] +
    • + [% END %] + [% IF showholds || showpriority %] +
    • + Holds and priority: + [% IF showpriority %] [% bibitemloo.rank %] [% END %] + [% IF showholds && showpriority %] out of [% END %] + [% IF showholds %] [% bibitemloo.reservecount %] [% END %] +
    • + [% END %] + - [% END %] -
    - [% IF ( bibitemloo.imageurl ) %][% END %] - [% bibitemloo.description %] - - [% IF showpriority %] [% bibitemloo.rank %] [% END %] - [% IF showholds && showpriority %] out of [% END %] - [% IF showholds %] [% bibitemloo.reservecount %] [% END %] - - - -

    - Clear date

    -
    - -

    - Clear date

    -
    - [% UNLESS ( bibitemloo.holdable ) %] - - [% ELSE %] - - [% END %] -
      -   - - - -
      - + +
    @@ -530,18 +547,19 @@ [% END %]
    Select a specific copy:
    Copy
    -
    + [% END %]
    [% UNLESS ( message ) %] [% UNLESS ( none_available ) %] - + [% END %] [% END %] -- 2.39.5