From: Mike Rylander Date: Mon, 16 Mar 2015 20:02:04 +0000 (-0400) Subject: webstaff: use contextItemGenerator instead of contextItemContainer X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f4e64dace471a6e779b78a2f5e4554c19f216e3d;p=Evergreen.git webstaff: use contextItemGenerator instead of contextItemContainer Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- 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 34fc9fe7fa..fd51af74a2 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 @@ -54,25 +54,8 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) max: '@', itype: '@' }, - controller : ['$scope', 'egTagTable', - function ( $scope , egTagTable) { - - if (!$scope.contextItemContainer) { - if ($scope.itype === 'tag') { - $scope.contextItemContainer = "default_context"; - // FIXME use contextItemGenerator - $scope.$parent[$scope.contextItemContainer] = egTagTable.getFieldTags(); - } else if ($scope.itype === 'sfc') { - $scope.contextItemContainer = "default_context"; - $scope.$parent[$scope.contextItemContainer] = - egTagTable.getSubfieldCodes($scope.$parent.field.tag); - } else if ($scope.itype === 'ind') { - $scope.contextItemContainer = "default_context"; - $scope.$parent[$scope.contextItemContainer] = - egTagTable.getIndicatorValues($scope.$parent.field.tag, $scope.$parent.indNumber); - } - } - + controller : ['$scope', + function ( $scope ) { if ($scope.contextItemContainer && angular.isArray($scope.$parent[$scope.contextItemContainer])) $scope.item_container = $scope.$parent[$scope.contextItemContainer]; @@ -133,7 +116,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) element.bind('change', function (e) { element.size = scope.max || parseInt(scope.content.length * 1.1) }); - if (scope.item_container) + if (scope.item_container && scope.item_container.length) element.bind('contextmenu', scope.showContext); } } @@ -154,6 +137,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) 'content="subfield[0]" '+ 'max="1" '+ 'on-keydown="onKeydown" '+ + 'context-item-generator="sf_code_options" '+ 'id="r{{field.record.subfield(\'901\',\'c\')[1]}}f{{field.position}}s{{subfield[2]}}code" '+ '/>'+ ''+ '', scope: { field: "=", subfield: "=", onKeydown: '=' }, - replace: true + replace: true, + controller : ['$scope', 'egTagTable', + function ( $scope , egTagTable) { + + $scope.sf_code_options = function () { + return egTagTable.getSubfieldCodes($scope.field.tag); + } + } + ] } }) @@ -182,10 +174,19 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) 'content="ind" '+ 'max="1" '+ 'on-keydown="onKeydown" '+ + 'context-item-generator="ind_val_options" '+ 'id="r{{field.record.subfield(\'901\',\'c\')[1]}}f{{field.position}}i{{indNumber}}"'+ '/>', scope: { ind : '=', field: '=', onKeydown: '=', indNumber: '@' }, - replace: true + replace: true, + controller : ['$scope', 'egTagTable', + function ( $scope , egTagTable) { + + $scope.ind_val_options = function () { + return egTagTable.getIndicatorValues($scope.field.tag, $scope.indNumber); + } + } + ] } }) @@ -200,10 +201,19 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) 'content="tag" '+ 'max="3" '+ 'on-keydown="onKeydown" '+ + 'context-item-generator="tag_options" '+ 'id="r{{field.record.subfield(\'901\',\'c\')[1]}}f{{field.position}}tag"'+ '/>', scope: { tag : '=', field: '=', onKeydown: '=' }, - replace: true + replace: true, + controller : ['$scope', 'egTagTable', + function ( $scope , egTagTable) { + + $scope.tag_options = function () { + return egTagTable.getFieldTags(); + } + } + ] } })