From 0383afc66ab889afc6af02203902d1d515723a96 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 25 Sep 2015 17:04:20 -0700 Subject: Add user preference to view project activity and starred project activity as default dashboard Closes #2662 --- app/controllers/root_controller.rb | 4 ++++ app/helpers/preferences_helper.rb | 4 +++- app/models/user.rb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 54171ff67c5..ad04c646e1b 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -22,6 +22,10 @@ class RootController < Dashboard::ProjectsController when 'stars' flash.keep redirect_to starred_dashboard_projects_path + when 'project_activity' + redirect_to activity_dashboard_path + when 'starred_project_activity' + redirect_to activity_dashboard_path(filter: 'starred') else return end diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index 7f1b6a69926..1b1f4162df4 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -3,7 +3,9 @@ module PreferencesHelper # Maps `dashboard` values to more user-friendly option text DASHBOARD_CHOICES = { projects: 'Your Projects (default)', - stars: 'Starred Projects' + stars: 'Starred Projects', + project_activity: "Your Projects' Activity", + starred_project_activity: "Starred Projects' Activity" }.with_indifferent_access.freeze # Returns an Array usable by a select field for more user-friendly option text diff --git a/app/models/user.rb b/app/models/user.rb index 25371f9138a..3879f3fd381 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -172,7 +172,7 @@ class User < ActiveRecord::Base # User's Dashboard preference # Note: When adding an option, it MUST go on the end of the array. - enum dashboard: [:projects, :stars] + enum dashboard: [:projects, :stars, :project_activity, :starred_project_activity] # User's Project preference # Note: When adding an option, it MUST go on the end of the array. -- cgit v1.2.1