tpl = _.template """
<div>
- <a href="<%= href %>" class="opac-button" style="margin-top: 0px; margin-bottom: 0px"><%= label %></a>
+ <a href="<%= href %>" class="opac-button <%= action_name %>" style="margin-top: 0px; margin-bottom: 0px"><%= label %></a>
</div>
"""
$.extend action, _of: $tr, _name: n
# Create a button for this action
- $ tpl href: action.href, label: Labels?[n] or n
+ $ 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) ->
._holdings_row id # Add an empty row
.appendTo $('#myopac_holds_div, #myopac_checked_div')
- # Fill in metadata values when they become available
+ # Fill in empty row when data becomes available
od.$.on
'od.interests': (ev, x) ->
interested = x.byID
'od.metadata': (ev, x) ->
+ # Fill in metadata columns
$("##{x.id}")._row_meta x, 'thumbnail', 'title', 'author', 'formats'
'od.availability': (ev, x) ->
# a hold.
if interested[x.id]?.type
window.history.go -2
+
else
- $("##{x.id}")._holdings_row_avail x
+ $("##{x.id}")
+ # Fill in availability column
+ ._holdings_row_avail x
+ # Auto-focus on place hold or checkout button
+ .find '.opac-button.hold, .opac-button.checkout'
+ .focus()
+ .end()
'myopac\/holds': ->