From 5e0f78ad8d515bf626b3d8b565f3277c80621203 Mon Sep 17 00:00:00 2001 From: Josh Stompro Date: Mon, 10 Feb 2020 08:35:31 -0600 Subject: [PATCH] LP#1862235 - Create MARC Record - Focus on template on load Focus on the template selector dropdown when interface loads. This removes the need to use the mouse, and speeds up using the interface. Pressing tab, then enter will submit the form with the default template selected. If the template needs to be changed, then pressing the first letter of the template will switch between the different options. This adds a directive named autoFocus to staff/cat/catalog/app.js, so adding "auto-focus" to an element will cause that element to have focus on load. Signed-off-by: Josh Stompro --- Open-ILS/src/templates/staff/cat/catalog/t_new_bib.tt2 | 2 +- Open-ILS/web/js/ui/default/staff/cat/catalog/app.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_new_bib.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_new_bib.tt2 index c5ffa77129..e183b7e98e 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_new_bib.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_new_bib.tt2 @@ -2,7 +2,7 @@
- +
diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index f05c363295..ee99fca146 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -269,6 +269,18 @@ function($scope , $routeParams , $location , $window , $q , egCore) { }]) + +.directive('autoFocus', function($timeout) { + return { + restrict: 'AC', + link: function(_scope, _element) { + $timeout(function(){ + _element[0].focus(); + }, 0); + } + }; +}) + .controller('CatalogCtrl', ['$scope','$routeParams','$location','$window','$q','egCore','egHolds','egCirc','egConfirmDialog','ngToast', 'egGridDataProvider','egHoldGridActions','egProgressDialog','$timeout','$uibModal','holdingsSvc','egUser','conjoinedSvc', -- 2.11.0