<div>
<div ng-show="bre && fastAdd" class="row pad-vert marcfastitemadd">
<div class="col-md-2">
- <label><input type="checkbox" ng-model="enable_fast_add"/> [% l('Add Item') %]</label>
+ <label><input ng-show="bre && fastAdd" type="checkbox" ng-model="enable_fast_add" focus-on-show/> [% l('Add Item') %]</label>
</div>
<div class="col-md-2">
- <input id="mfiacn" class="form-control" ng-show="enable_fast_add" type="text" placeholder="[% l('Call Number') %]" ng-model="fast_item_callnumber"/>
+ <input id="mfiacn" class="form-control" ng-show="enable_fast_add" type="text" placeholder="[% l('Call Number') %]" ng-model="fast_item_callnumber" focus-on-show/>
</div>
<div class="col-md-2">
<input id="mfiabc" class="form-control" ng-show="enable_fast_add" type="text" placeholder="[% l('Barcode') %]" ng-model="fast_item_barcode"/>
};
})
+.directive('focusOnShow', function($timeout) {
+ return {
+ restrict: 'A',
+ link: function($scope, $element, $attr) {
+ if ($attr.ngShow){
+ $scope.$watch($attr.ngShow, function(newValue){
+ if(newValue){
+ $timeout(function(){
+ $element[0].focus();
+ }, 0);
+ }
+ })
+ }
+ if ($attr.ngHide){
+ $scope.$watch($attr.ngHide, function(newValue){
+ if(!newValue){
+ $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',