From 3be26122541dcf32960b5a69691446db31a33be7 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Thu, 17 Sep 2015 18:11:11 -0400 Subject: [PATCH] webstaff: Select on focus for tag, indicators, and sf codes Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton --- .../js/ui/default/staff/cat/services/marcedit.js | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js index ceb0e5bb50..1a92f138d0 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js @@ -64,7 +64,8 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) contextItemContainer: '@', contextItemGenerator: '=', max: '@', - itype: '@' + itype: '@', + selectOnFocus: '=' }, controller : ['$scope', function ( $scope ) { @@ -142,6 +143,11 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) if (scope.onKeydown) element.bind('keydown', {scope : scope}, scope.onKeydown); + if (Boolean(scope.selectOnFocus)) { + element.addClass('noSelection'); + element.bind('focus', function () { element.select() }); + } + element.bind('change', function (e) { element.size = scope.max || parseInt(scope.content.length * 1.1) }); element.bind('contextmenu', {scope : scope}, scope.showContext); @@ -293,6 +299,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) 'for="r{{field.record.subfield(\'901\',\'c\')[1]}}f{{field.position}}s{{subfield[2]}}code" '+ '>‡