From: Jeff Davis Date: Mon, 8 Dec 2014 18:36:35 +0000 (-0800) Subject: RT26522: Don't treat non-available items as a special case X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f1c5f115dbbb51dff82491a9b5b02facc3b388f6;p=contrib%2Foverdrive-eg-opac.git RT26522: Don't treat non-available items as a special case Previously, when the 'available' element of a Library Availability API response was undefined, we assumed that the title itself was no longer part of the library's current Overdrive collection. Thus, the Place Hold link was removed and a "No longer available" message was displayed in the Status column. In fact, however, it may just be the case that the item is currently in the collection, but all copies are checked out. So it's preferable to retain the Place Hold link and show "0 of X available" in the Status column -- in other words, don't treat undefined availability as a special case. Signed-off-by: Jeff Davis --- diff --git a/src/od_pages_opac.coffee b/src/od_pages_opac.coffee index e8d5105..ebd47cb 100644 --- a/src/od_pages_opac.coffee +++ b/src/od_pages_opac.coffee @@ -101,19 +101,13 @@ define [ return @ unless avail - $x = - if avail.available is undefined - $('') - .css 'color', 'red' - .text 'No longer available' - else - tpl = _.template """ - <%= n_avail %> of <%= n_owned %> available, <%= n_holds %> holds - """ - $ tpl - n_avail: avail.copiesAvailable - n_owned: avail.copiesOwned - n_holds: avail.numberOfHolds + tpl = _.template """ + <%= n_avail %> of <%= n_owned %> available, <%= n_holds %> holds + """ + $x = $ tpl + n_avail: avail.copiesAvailable + n_owned: avail.copiesOwned + n_holds: avail.numberOfHolds @find('.result_holdings_table .status') .append $x @@ -162,19 +156,13 @@ define [ return @ unless avail - $x = - if avail.available is undefined - $('') - .css 'color', 'red' - .text 'No longer available' - else - tpl = _.template """ - <%= n_avail %> of <%= n_owned %> available, <%= n_holds %> holds - """ - $ tpl - n_avail: avail.copiesAvailable - n_owned: avail.copiesOwned - n_holds: avail.numberOfHolds + tpl = _.template """ + <%= n_avail %> of <%= n_owned %> available, <%= n_holds %> holds + """ + $x = $ tpl + n_avail: avail.copiesAvailable + n_owned: avail.copiesOwned + n_holds: avail.numberOfHolds @find '.status' .append $x @@ -185,11 +173,6 @@ define [ _replace_place_hold_link: (avail, type_of_interest) -> return @ unless avail - if avail.available is undefined - @find '.place_hold' - .remove() - .end() - # Find the place hold link that we want to replace $a = @find '.place_hold > a'