From 07895f87d87bcfdba77a9ed147c101d7eb55c3d2 Mon Sep 17 00:00:00 2001 From: Steven Chan Date: Sun, 31 Aug 2014 11:53:16 -0700 Subject: [PATCH] Auto-focus on place hold or checkout action buttons Signed-off-by: Steven Chan --- src/od_action.coffee | 4 ++-- src/overdrive.coffee | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/od_action.coffee b/src/od_action.coffee index 2617fcb..5f09245 100644 --- a/src/od_action.coffee +++ b/src/od_action.coffee @@ -293,7 +293,7 @@ define [ tpl = _.template """
- <%= label %> + <%= label %>
""" @@ -306,7 +306,7 @@ define [ $.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) -> diff --git a/src/overdrive.coffee b/src/overdrive.coffee index d84a21a..273ae9b 100644 --- a/src/overdrive.coffee +++ b/src/overdrive.coffee @@ -277,7 +277,7 @@ require [ ._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) -> @@ -287,6 +287,7 @@ require [ interested = x.byID 'od.metadata': (ev, x) -> + # Fill in metadata columns $("##{x.id}")._row_meta x, 'thumbnail', 'title', 'author', 'formats' 'od.availability': (ev, x) -> @@ -299,8 +300,15 @@ require [ # 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': -> -- 2.11.0