From: Steven Chan Date: Sun, 14 Sep 2014 22:39:09 +0000 (-0700) Subject: Handle errors arising from downloading content X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3865fb236a4162f7c172e76c564b03ba90bc8d45;p=contrib%2Foverdrive-eg-opac.git Handle errors arising from downloading content Any such errors will be embedded in the search parameters of the myopac/circ page URL. We decode the various components and show them inside a floating notification box, otherwise we render the page as normally done. Signed-off-by: Steven Chan --- diff --git a/src/od_action.coffee b/src/od_action.coffee index 7dee1a8..8b330a1 100644 --- a/src/od_action.coffee +++ b/src/od_action.coffee @@ -474,7 +474,7 @@ define [ _notify: (title, text) -> @dialog - position: my: 'top', at: 'right top' + #position: my: 'top', at: 'right top' minHeight: 0 autoOpen: true draggable: false @@ -484,7 +484,7 @@ define [ close: -> $(@).dialog 'destroy' title: title - .text text + .html text # Get the title of e-item in a row context _etitle: -> @find('.title a').text() diff --git a/src/overdrive.coffee b/src/overdrive.coffee index 164c797..ad440a6 100644 --- a/src/overdrive.coffee +++ b/src/overdrive.coffee @@ -380,6 +380,15 @@ require [ if id = search_params 'interested' return routes['opac\/place_hold'] id + # If there is an error message embedded in the search parameters + # that resulted from an attempt at downloading content, show it in + # a floating notification box. + if code = search_params 'ErrorCode' + $('
')._notify 'Error message', """ +

#{search_params 'ErrorDescription'}

+

Details: #{search_params 'ErrorDetails'}

+ """ + # Rewrite the text in the warning box to distinguish physical items from e-items unless search_params 'e_items' $('.warning_box').text $('.warning_box').text().replace ' items', ' physical items'