From 244bdb3cec39b7db6dc9e99b4df8b5003c3f1458 Mon Sep 17 00:00:00 2001 From: Nikita Konovalov Date: Wed, 14 May 2014 18:15:21 +0400 Subject: [PATCH] Configure Timeline from Story details A modal added to allow configuring th Timeline event filter from Sotory details page. Change-Id: I570d1756d0ccf0857b713881c67004ec294e1698 --- .../controllers/story_detail_controller.js | 13 +++ .../controllers/timeline_filter_controller.js | 39 +++++++++ src/app/templates/story/detail.html | 5 +- src/app/templates/story/update_filter.html | 80 +++++++++++++++++++ 4 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 src/app/stories/controllers/timeline_filter_controller.js create mode 100644 src/app/templates/story/update_filter.html diff --git a/src/app/stories/controllers/story_detail_controller.js b/src/app/stories/controllers/story_detail_controller.js index 33b18e54..d804a083 100644 --- a/src/app/stories/controllers/story_detail_controller.js +++ b/src/app/stories/controllers/story_detail_controller.js @@ -161,6 +161,19 @@ angular.module('sb.story').controller('StoryDetailController', return modalInstance.result; }; + $scope.updateFilter = function () { + var modalInstance = $modal.open({ + templateUrl: 'app/templates/story/update_filter.html', + controller: 'TimelineFilterController' + }); + + modalInstance.result.then(function(enabled_event_types) { + $scope.enabled_event_types = enabled_event_types; + }); + // Return the modal's promise. + return modalInstance.result; + }; + /** * Initialize */ diff --git a/src/app/stories/controllers/timeline_filter_controller.js b/src/app/stories/controllers/timeline_filter_controller.js new file mode 100644 index 00000000..07f73135 --- /dev/null +++ b/src/app/stories/controllers/timeline_filter_controller.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2014 Mirantis Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +angular.module('sb.story').controller('TimelineFilterController', + function($scope, $modalInstance, Preference) { + 'use strict'; + + function init() { + $scope.enabled_event_types = + Preference.get('display_events_filter'); + } + + $scope.close = function () { + $modalInstance.dismiss('cancel'); + }; + + $scope.save = function () { + Preference.set('display_events_filter', + $scope.enabled_event_types); + return $modalInstance.close($scope.enabled_event_types); + }; + + init(); + + }) +; \ No newline at end of file diff --git a/src/app/templates/story/detail.html b/src/app/templates/story/detail.html index 6eb7447e..a1553b16 100644 --- a/src/app/templates/story/detail.html +++ b/src/app/templates/story/detail.html @@ -186,8 +186,9 @@