RT26084: Hide Suspend button on suspended holds
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Fri, 14 Nov 2014 20:42:41 +0000 (12:42 -0800)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 26 Nov 2014 22:06:10 +0000 (14:06 -0800)
Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
src/od_action.coffee
src/od_pages_myopac.coffee

index a524544..b0441b8 100644 (file)
@@ -275,7 +275,7 @@ define [
 
                # Build action buttons and dialogs given specifications as follows.
                # actions = [ { name: { href: h, method: m, fields: [ { name: n, value: v, options: [...] } ] } ]
-               _actions: (actions, id) ->
+               _actions: (actions, id, suspended) ->
 
                        tpl = _.template """
                        <div>
@@ -288,17 +288,19 @@ define [
 
                        $buttons = for n, action of actions
 
-                               # Extend the action object with context
-                               $.extend action, _of: $tr, _name: n, _id: id
+                               unless suspended? and n is 'addSuspension'
 
-                               # Create a button for this action
-                               $ tpl href: action.href, action_name: n, label: Labels?[n] or n
+                                       # Extend the action object with context
+                                       $.extend action, _of: $tr, _name: n, _id: id
 
-                               # On clicking the button, build a new dialog using the extended action object
-                               .on 'click', action, (ev) ->
-                                       ev.preventDefault()
-                                       $('<div>')['_' + ev.data._name] ev.data
-                                       return false
+                                       # Create a button for this action
+                                       $ tpl href: action.href, action_name: n, label: Labels?[n] or n
+
+                                       # On clicking the button, build a new dialog using the extended action object
+                                       .on 'click', action, (ev) ->
+                                               ev.preventDefault()
+                                               $('<div>')['_' + ev.data._name] ev.data
+                                               return false
 
                        @empty().append $buttons
 
index 2628307..40a27ec 100644 (file)
@@ -295,11 +295,13 @@ define [
 
                _holds_row: (hold) ->
 
+                       suspended = if hold.holdSuspension? then 1
+
                        @find 'td.availability'
                                ._holds_row_avail1 hold
                                .end()
                        .find 'td.actions'
-                               ._actions hold.actions, hold.reserveId
+                               ._actions hold.actions, hold.reserveId, suspended
                                .end()
 
                # Show a title, author, or format by using the given metadata object