summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-09-25 17:04:20 -0700
committerStan Hu <stanhu@gmail.com>2015-09-26 08:46:05 -0700
commit0383afc66ab889afc6af02203902d1d515723a96 (patch)
tree671139b4d862fa7c04ec5a1930dd3f8cf22dfefc /app
parent6d6918105941bcb868b59350f56eb2f76efd7cf5 (diff)
downloadgitlab-ce-0383afc66ab889afc6af02203902d1d515723a96.tar.gz
Add user preference to view project activity and starred project activity as default dashboard
Closes #2662
Diffstat (limited to 'app')
-rw-r--r--app/controllers/root_controller.rb4
-rw-r--r--app/helpers/preferences_helper.rb4
-rw-r--r--app/models/user.rb2
3 files changed, 8 insertions, 2 deletions
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.