diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-03-26 11:08:48 +0100 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-03-26 11:08:48 +0100 |
commit | ea8bd204e3c6fe297cdea07ee0ac8e1e8daf87c1 (patch) | |
tree | 347780b5963b0d7983ceee6389652d2dd35b1dd6 | |
parent | c44de4f21ee6db857f0c6f086f7a3ce649d1c50c (diff) | |
parent | c3a98d8fcc2f9f7a0ce8816c8cf9dbebe58e64e9 (diff) | |
download | gitlab-ce-ea8bd204e3c6fe297cdea07ee0ac8e1e8daf87c1.tar.gz |
Merge branch 'feature--preferences-dashboard-groups' of https://gitlab.com/eliasw/gitlab-ce
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | app/controllers/root_controller.rb | 4 | ||||
-rw-r--r-- | app/helpers/preferences_helper.rb | 4 | ||||
-rw-r--r-- | app/models/user.rb | 2 | ||||
-rw-r--r-- | spec/controllers/root_controller_spec.rb | 22 | ||||
-rw-r--r-- | spec/helpers/preferences_helper_spec.rb | 4 |
6 files changed, 35 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index bcfd25a0df1..c9527e6627e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,8 @@ v 8.7.0 (unreleased) - Make HTTP(s) label consistent on clone bar (Stan Hu) - Fix avatar stretching by providing a cropping feature - Add links to CI setup documentation from project settings and builds pages + - Implement 'Groups View' as an option for dashboard preferences !3379 (Elias W.) + - Implement 'TODOs View' as an option for dashboard preferences !3379 (Elias W.) v 8.6.2 (unreleased) - Comments on confidential issues don't show up in activity feed to non-members diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index ad04c646e1b..627be74a38f 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -26,6 +26,10 @@ class RootController < Dashboard::ProjectsController redirect_to activity_dashboard_path when 'starred_project_activity' redirect_to activity_dashboard_path(filter: 'starred') + when 'groups' + redirect_to dashboard_groups_path + when 'todos' + redirect_to dashboard_todos_path else return end diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index c73cb3028ee..c3832cf5d65 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -12,7 +12,9 @@ module PreferencesHelper projects: 'Your Projects (default)', stars: 'Starred Projects', project_activity: "Your Projects' Activity", - starred_project_activity: "Starred Projects' Activity" + starred_project_activity: "Starred Projects' Activity", + groups: "Your Groups", + todos: "Your Todos" }.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 9c315cfe966..128ddc2a694 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -184,7 +184,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, :project_activity, :starred_project_activity] + enum dashboard: [:projects, :stars, :project_activity, :starred_project_activity, :groups, :todos] # User's Project preference # Note: When adding an option, it MUST go on the end of the array. diff --git a/spec/controllers/root_controller_spec.rb b/spec/controllers/root_controller_spec.rb index 5a104ae7c99..b14d275f7fa 100644 --- a/spec/controllers/root_controller_spec.rb +++ b/spec/controllers/root_controller_spec.rb @@ -43,6 +43,28 @@ describe RootController do end end + context 'who has customized their dashboard setting for groups' do + before do + user.update_attribute(:dashboard, 'groups') + end + + it 'redirects to their group list' do + get :index + expect(response).to redirect_to dashboard_groups_path + end + end + + context 'who has customized their dashboard setting for todos' do + before do + user.update_attribute(:dashboard, 'todos') + end + + it 'redirects to their todo list' do + get :index + expect(response).to redirect_to dashboard_todos_path + end + end + context 'who uses the default dashboard setting' do it 'renders the default dashboard' do get :index diff --git a/spec/helpers/preferences_helper_spec.rb b/spec/helpers/preferences_helper_spec.rb index e5df59c4fba..2f9291afc3f 100644 --- a/spec/helpers/preferences_helper_spec.rb +++ b/spec/helpers/preferences_helper_spec.rb @@ -19,7 +19,9 @@ describe PreferencesHelper do ['Your Projects (default)', 'projects'], ['Starred Projects', 'stars'], ["Your Projects' Activity", 'project_activity'], - ["Starred Projects' Activity", 'starred_project_activity'] + ["Starred Projects' Activity", 'starred_project_activity'], + ["Your Groups", 'groups'], + ["Your Todos", 'todos'] ] end end |