diff --git a/src/app/profile/controller/profile_preferences_controller.js b/src/app/profile/controller/profile_preferences_controller.js index 67c4a0e1..7abb0d76 100644 --- a/src/app/profile/controller/profile_preferences_controller.js +++ b/src/app/profile/controller/profile_preferences_controller.js @@ -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!'; }; }); \ No newline at end of file diff --git a/src/app/stories/controllers/story_detail_controller.js b/src/app/stories/controllers/story_detail_controller.js index 04b1bd35..c0cfbd1a 100644 --- a/src/app/stories/controllers/story_detail_controller.js +++ b/src/app/stories/controllers/story_detail_controller.js @@ -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. diff --git a/src/app/stories/module.js b/src/app/stories/module.js index 59241940..e8d73186 100644 --- a/src/app/stories/module.js +++ b/src/app/stories/module.js @@ -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); }); diff --git a/src/app/templates/profile/preferences.html b/src/app/templates/profile/preferences.html index bb95c939..5ad7799b 100644 --- a/src/app/templates/profile/preferences.html +++ b/src/app/templates/profile/preferences.html @@ -56,6 +56,59 @@
+
+ + +

+ Which types of Timeline events would you like to be + displayed? +

+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+ +
+