From 53ade1eccfa7b58fe852ec1cd97fd5e04ee763db Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Fri, 14 Nov 2014 12:42:41 -0800 Subject: [PATCH] RT26084: Hide Suspend button on suspended holds Signed-off-by: Jeff Davis --- src/od_action.coffee | 22 ++++++++++++---------- src/od_pages_myopac.coffee | 4 +++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/od_action.coffee b/src/od_action.coffee index a524544..b0441b8 100644 --- a/src/od_action.coffee +++ b/src/od_action.coffee @@ -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 """
@@ -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() - $('
')['_' + 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() + $('
')['_' + ev.data._name] ev.data + return false @empty().append $buttons diff --git a/src/od_pages_myopac.coffee b/src/od_pages_myopac.coffee index 2628307..40a27ec 100644 --- a/src/od_pages_myopac.coffee +++ b/src/od_pages_myopac.coffee @@ -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 -- 2.11.0