Lp 1752968: Select content when focusing on the barcode field. user/dyrcona/lp1752968-add-volumes-cursor-focus
authorJason Stephenson <jason@sigio.com>
Tue, 18 Dec 2018 14:26:11 +0000 (09:26 -0500)
committerJason Stephenson <jason@sigio.com>
Tue, 18 Dec 2018 14:26:11 +0000 (09:26 -0500)
Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index b99672c..aaf07ce 100644 (file)
@@ -489,7 +489,7 @@ function(egCore , $q) {
                     '<input id="{{callNumber.id()}}_{{copy.id()}}"'+
                     ' eg-enter="nextBarcode(copy.id())" class="form-control"'+
                     ' type="text" ng-model="barcode" ng-change="updateBarcode()"'+
-                    ' autofocus/>'+
+                    ' ng-focus="selectOnFocus($event)" autofocus/>'+
                     '<div class="label label-danger" ng-if="duplicate_barcode">{{duplicate_barcode_string}}</div>'+
                     '<div class="label label-danger" ng-if="empty_barcode">{{empty_barcode_string}}</div>'+
                 '</div>'+
@@ -509,6 +509,11 @@ function(egCore , $q) {
 
                 if (!$scope.copy.barcode()) $scope.copy.empty_barcode = true;
 
+                $scope.selectOnFocus = function($event) {
+                    if (!$scope.copy.empty_barcode)
+                        $event.target.select();
+                }
+
                 $scope.nextBarcode = function (i) {
                     $scope.focusNext(i, $scope.barcode);
                 }