From: Galen Charlton Date: Mon, 12 Jun 2017 16:56:53 +0000 (-0400) Subject: webstaff: make chron caption directive that can be linked X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=53fd09912120db7cd6663424a9b55b6efe551ec0;p=working%2FEvergreen.git webstaff: make chron caption directive that can be linked Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/templates/staff/serials/index.tt2 b/Open-ILS/src/templates/staff/serials/index.tt2 index 20b8994bd8..b09dca2fa8 100644 --- a/Open-ILS/src/templates/staff/serials/index.tt2 +++ b/Open-ILS/src/templates/staff/serials/index.tt2 @@ -62,6 +62,13 @@ angular.module('egCoreMod').run(['egStrings', function(s) { s.CONFIRM_DELETE_MFHDS = "[% l('Delete selected MFHD(s)?') %]"; s.CONFIRM_DELETE_MFHDS_MESSAGE = "[% l('Will delete {{items}} MFHD(s).') %]"; + + s.CHRON_LABEL_YEAR = "[% l('Year') %]"; + s.CHRON_LABEL_SEASON = "[% l('Season') %]"; + s.CHRON_LABEL_MONTH = "[% l('Month') %]"; + s.CHRON_LABEL_WEEK = "[% l('Week') %]"; + s.CHRON_LABEL_DAY = "[% l('Day') %]"; + s.CHRON_LABEL_HOUR = "[% l('Hour') %]"; }]); [% END %] diff --git a/Open-ILS/src/templates/staff/serials/t_chron_selector.tt2 b/Open-ILS/src/templates/staff/serials/t_chron_selector.tt2 new file mode 100644 index 0000000000..af5a43cdd5 --- /dev/null +++ b/Open-ILS/src/templates/staff/serials/t_chron_selector.tt2 @@ -0,0 +1,5 @@ + diff --git a/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 b/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 index 3dc1bdd076..8dd4bdd086 100644 --- a/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 @@ -180,14 +180,7 @@
[% l('Level [_1]', '{{$index + 1}}') %]
- +
@@ -213,14 +206,7 @@
[% l('Level [_1]', '{{$index + 1}}') %]
- +
diff --git a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js index ec743a9eb9..1eafdfc708 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js +++ b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js @@ -508,6 +508,9 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) { depth : 0 }; + $scope.chron_captions = []; + $scope.alt_chron_captions = []; + $scope.handle_save = function() { $scope.patternCode = JSON.stringify($scope.pattern.compile()); if ($scope.share.pattern_name !== null) { @@ -532,6 +535,51 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) { } }) +.directive('egChronSelector', function() { + return { + transclude: true, + restrict: 'E', + scope: { + ngModel : '=', + chronLevel : '=', + linkedSelector : '=', + }, + templateUrl: './serials/t_chron_selector', + controller: + ['$scope','$q','egCore', +function($scope , $q , egCore) { + $scope.options = [ + { value : 'year', label : egCore.strings.CHRON_LABEL_YEAR, disabled: false }, + { value : 'season', label : egCore.strings.CHRON_LABEL_SEASON, disabled: false }, + { value : 'month', label : egCore.strings.CHRON_LABEL_MONTH, disabled: false }, + { value : 'week', label : egCore.strings.CHRON_LABEL_WEEK, disabled: false }, + { value : 'day', label : egCore.strings.CHRON_LABEL_DAY, disabled: false }, + { value : 'hour', label : egCore.strings.CHRON_LABEL_HOUR, disabled: false } + ]; + var levels = { + 'year' : 0, + 'season' : 1, + 'month' : 1, + 'week' : 2, + 'day' : 3, + 'hour' : 4 + }; + $scope.$watch('ngModel', function(newVal, oldVal) { + $scope.linkedSelector[$scope.chronLevel] = $scope.ngModel; + }); + $scope.$watch('linkedSelector', function(newVal, oldVal) { + if ($scope.chronLevel > 0 && $scope.linkedSelector[$scope.chronLevel - 1]) { + var level_to_disable = levels[ $scope.linkedSelector[$scope.chronLevel - 1] ]; + for (var i = 0; i < $scope.options.length; i++) { + $scope.options[i].disabled = + (levels[ $scope.options[i].value ] <= level_to_disable); + } + } + }, true); +}] + } +}) + .directive('egMonthSelector', function() { return { transclude: true,