From 2ec1699c72ca1c214acdb7ab7df3e0af4bcdf340 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 27 Mar 2015 17:47:11 -0400 Subject: [PATCH] webstaff: New directive for FF editing Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- .../js/ui/default/staff/cat/services/marcedit.js | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) 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 65211899f5..d779857e6e 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 @@ -124,6 +124,47 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) } }]) +.directive("egMarcEditFixedField", function () { + return { + transclude: true, + restrict: 'E', + template: '
'+ + ''+ + ''+ + '
, + scope: { record: "=", fixedField: "@" }, + replace: true, + controller : ['$scope', '$element', 'egTagTable', + function ( $scope , $element , egTagTable) { + $($element).children().css({ display : 'none' }); + $scope.rtype = $scope.record.recordType(); + $scope.me = null; + + egTagTable.fetchFFPosTable( $scope.rtype ).then(function (ff_list) { + ff_list.forEach( function (ff) { + if (!$scope.me && ff.tag != '006') { // we're going to ignore 006 for now... + if (ff.fixed_field == $scope.fixedField && ff.rec_type == $scope.rtype) { + $($element).children().css({ display : 'block' }); + $scope.me = ff; + } + } + }); + }).then(function () { + if ($scope.me) { + var input = $('#' + $scope.fixedField + '_ff_input'); + input.attr('maxlength', $scope.me.length) + input.val($scope.record.getFixedField($scope.me.fixed_field); + input.on('keypress', function(e) { + $scope.record.setFixedField($scope.me.fixed_field, input.val()); + }); + } + }); + + } + ] + } +}) + .directive("egMarcEditSubfield", function () { return { transclude: true, @@ -668,6 +709,8 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) $scope.bib_source = $scope[$scope.record_type].source(); } + }).then(function(){ + return egTagTable.fetchFFPosTable($scope.calculated_record_type) }).then(setCaret); } -- 2.11.0