diff options
author | Luke Bennett <lbennett@gitlab.com> | 2018-09-13 16:04:43 +0300 |
---|---|---|
committer | Luke Bennett <lbennett@gitlab.com> | 2018-09-24 13:41:29 +0300 |
commit | f8e74da72115bc8e9908385da9c46ae0e100e8e5 (patch) | |
tree | 8312d76a2f160a91a25c33be43eac49a1002cf18 /app/helpers/dashboard_helper.rb | |
parent | 769808732d5b3542726a5839d6a22da62fd9abeb (diff) |
Review changes
Diffstat (limited to 'app/helpers/dashboard_helper.rb')
-rw-r--r-- | app/helpers/dashboard_helper.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index 19aa55a8d49..7a0e2135b94 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -19,6 +19,29 @@ module DashboardHelper links.any? { |link| dashboard_nav_link?(link) } end + def controller_action_to_child_dashboards(controller = controller_name, action = action_name) + case "#{controller}##{action}" + when 'projects#index', 'root#index', 'projects#starred', 'projects#trending' + ['projects', 'stars'] + when 'dashboard#activity' + ['starred_project_activity', 'project_activity'] + when 'groups#index' + ['groups'] + when 'todos#index' + ['todos'] + when 'dashboard#issues' + ['issues'] + when 'dashboard#merge_requests' + ['merge_requests'] + else + [] + end + end + + def is_default_dashboard?(user = current_user) + controller_action_to_child_dashboards.any? {|dashboard| dashboard == user.dashboard } + end + private def get_dashboard_nav_links |