Handle errors arising from downloading content
authorSteven Chan <steven3416@gmail.com>
Sun, 14 Sep 2014 22:39:09 +0000 (15:39 -0700)
committerSteven Chan <steven3416@gmail.com>
Sun, 14 Sep 2014 22:39:09 +0000 (15:39 -0700)
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 <steven3416@gmail.com>
src/od_action.coffee
src/overdrive.coffee

index 7dee1a8..8b330a1 100644 (file)
@@ -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()
index 164c797..ad440a6 100644 (file)
@@ -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'
+                               $('<div>')._notify 'Error message', """
+                                       <p>#{search_params 'ErrorDescription'}</p>
+                                       <p>Details: #{search_params 'ErrorDetails'}</p>
+                                       """
+
                        # 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'