Merge "Make Timeline configurable"
This commit is contained in:
commit
db10f3c933
@ -23,9 +23,13 @@ angular.module('sb.profile').controller('ProfilePreferencesController',
|
||||
'use strict';
|
||||
|
||||
$scope.pageSize = Preference.get('page_size');
|
||||
$scope.enabled_event_types = Preference.get('display_events_filter');
|
||||
|
||||
$scope.save = function () {
|
||||
Preference.set('page_size', $scope.pageSize);
|
||||
Preference.set('display_events_filter',
|
||||
$scope.enabled_event_types);
|
||||
|
||||
$scope.message = 'Preferences Saved!';
|
||||
};
|
||||
});
|
@ -19,7 +19,7 @@
|
||||
*/
|
||||
angular.module('sb.story').controller('StoryDetailController',
|
||||
function ($log, $scope, $state, $stateParams, $modal, Story,
|
||||
Session, User) {
|
||||
Session, User, Preference) {
|
||||
'use strict';
|
||||
|
||||
// Parse the ID
|
||||
@ -27,6 +27,8 @@ angular.module('sb.story').controller('StoryDetailController',
|
||||
parseInt($stateParams.storyId, 10) :
|
||||
null;
|
||||
|
||||
$scope.enabled_event_types = Preference.get('display_events_filter');
|
||||
|
||||
/**
|
||||
* Generic service error handler. Assigns errors to the view's scope,
|
||||
* and unsets our flags.
|
||||
|
@ -20,7 +20,8 @@
|
||||
*/
|
||||
angular.module('sb.story', ['ui.router', 'sb.services', 'sb.util',
|
||||
'ui.bootstrap'])
|
||||
.config(function ($stateProvider, $urlRouterProvider) {
|
||||
.config(function ($stateProvider, $urlRouterProvider, PreferenceProvider,
|
||||
TimelineEventTypes) {
|
||||
'use strict';
|
||||
|
||||
// URL Defaults.
|
||||
@ -42,4 +43,15 @@ angular.module('sb.story', ['ui.router', 'sb.services', 'sb.util',
|
||||
url: '/{storyId:[0-9]+}',
|
||||
templateUrl: 'app/templates/story/detail.html'
|
||||
});
|
||||
|
||||
// Register a preference for filtering timeline events.
|
||||
// By default all types of events should be displayed.
|
||||
|
||||
var events_filter_defaults = {};
|
||||
TimelineEventTypes.forEach(function(type) {
|
||||
events_filter_defaults[type] = true;
|
||||
});
|
||||
|
||||
PreferenceProvider.addPreference('display_events_filter',
|
||||
events_filter_defaults);
|
||||
});
|
||||
|
@ -56,6 +56,59 @@
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Timeline events</label>
|
||||
|
||||
<p class="help-block">
|
||||
Which types of Timeline events would you like to be
|
||||
displayed?
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" name="enabledTypes"
|
||||
id="storyCreated"
|
||||
ng-model="enabled_event_types.story_created">
|
||||
<label for="storyCreated">Story created</label>
|
||||
<br/>
|
||||
<input type="checkbox" name="enabledTypes"
|
||||
id="storyDetailsChanged"
|
||||
ng-model="enabled_event_types.story_details_changed">
|
||||
<label for="storyDetailsChanged">Story details changed</label>
|
||||
<br/>
|
||||
<input type="checkbox" name="enabledTypes"
|
||||
id="taskCreated"
|
||||
ng-model="enabled_event_types.task_created">
|
||||
<label for="taskCreated">Task created</label>
|
||||
<br/>
|
||||
<input type="checkbox" name="enabledTypes"
|
||||
id="taskAssigneeChanged"
|
||||
ng-model="enabled_event_types.task_assignee_changed">
|
||||
<label for="taskAssigneeChanged">Task assignee changed</label>
|
||||
<br/>
|
||||
<input type="checkbox" name="enabledTypes"
|
||||
id="taskStatusChanged"
|
||||
ng-model="enabled_event_types.task_status_changed">
|
||||
<label for="taskStatusChanged">Task status changed</label>
|
||||
<br/>
|
||||
<input type="checkbox" name="enabledTypes"
|
||||
id="taskDetailsChanged"
|
||||
ng-model="enabled_event_types.task_details_changed">
|
||||
<label for="taskDetailsChanged">Task details Changed</label>
|
||||
<br/>
|
||||
<input type="checkbox" name="enabledTypes"
|
||||
id="taskDeleted"
|
||||
ng-model="enabled_event_types.task_deleted">
|
||||
<label for="taskDeleted">Task deleted</label>
|
||||
<br/>
|
||||
<input type="checkbox" name="enabledTypes"
|
||||
id="userComment"
|
||||
ng-model="enabled_event_types.user_comment">
|
||||
<label for="userComment">User comment</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="form-group">
|
||||
<button type="button" class="btn btn-default"
|
||||
ng-click="save()">
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="discussion-comment">
|
||||
<div class="discussion-comment" ng-show="enabled_event_types.story_created">
|
||||
<p class="discussion-comment-author">
|
||||
{{ author.full_name }} has created this story.
|
||||
<span class="pull-right">{{event.created_at | date: 'medium'}}</span>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="discussion-comment">
|
||||
<div class="discussion-comment" ng-show="enabled_event_types.story_details_Changed">
|
||||
<p class="discussion-comment-author">
|
||||
{{ author.full_name }} has updated this story.
|
||||
<span class="pull-right">{{event.created_at | date: 'medium'}}</span>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="discussion-comment">
|
||||
<div class="discussion-comment" ng-show="enabled_event_types.task_assignee_changed">
|
||||
<p class="discussion-comment-author">
|
||||
{{author.full_name}} has updated assignee for task {{ event_info.task_title }}:
|
||||
{{ event_info.old_assignee_fullname }} ==> {{ event_info.new_assignee_fullname }}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="discussion-comment">
|
||||
<div class="discussion-comment" ng-show="enabled_event_types.task_created">
|
||||
<p class="discussion-comment-author">
|
||||
{{ author.full_name }} has created a task {{ event_info.task_title }}
|
||||
<span class="pull-right">{{event.created_at | date: 'medium'}}</span>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="discussion-comment">
|
||||
<div class="discussion-comment" ng-show="enabled_event_types.task_deleted">
|
||||
<p class="discussion-comment-author">
|
||||
{{ author.full_name }} has deleted a task {{ event_info.task_title }}
|
||||
<span class="pull-right">{{event.created_at | date: 'medium'}}</span>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="discussion-comment">
|
||||
<div class="discussion-comment" ng-show="enabled_event_types.task_details_changed">
|
||||
<p class="discussion-comment-author">
|
||||
{{ author.full_name }} has updated {{ event_info.task_title }}
|
||||
<span class="pull-right">{{event.created_at | date: 'medium'}}</span>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="discussion-comment">
|
||||
<div class="discussion-comment" ng-show="enabled_event_types.task_status_changed">
|
||||
<p class="discussion-comment-author">
|
||||
{{author.full_name}} has updated a task {{ event_info.task_title }} status:
|
||||
{{ event_info.old_status }} ==> {{ event_info.new_status }}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="discussion-comment">
|
||||
<div class="discussion-comment" ng-show="enabled_event_types.user_comment">
|
||||
<p class="discussion-comment-author">
|
||||
{{ author.full_name }}
|
||||
<span class="pull-right">{{event.created_at | date: 'medium'}}</span>
|
||||
|
28
src/app/util/constants/timeline_event_type.js
Normal file
28
src/app/util/constants/timeline_event_type.js
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.util').constant('TimelineEventTypes',
|
||||
[
|
||||
'story_created',
|
||||
'story_details_changed',
|
||||
'task_created',
|
||||
'task_assignee_changed',
|
||||
'task_status_changed',
|
||||
'task_details_changed',
|
||||
'task_deleted',
|
||||
'user_comment'
|
||||
]
|
||||
);
|
Loading…
Reference in New Issue
Block a user