summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-20 18:38:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-20 18:38:24 +0000
commit983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch)
treeb153cd387c14ba23bd5a07514c7c01fddf6a78a0 /app/helpers
parenta2bddee2cdb38673df0e004d5b32d9f77797de64 (diff)
downloadgitlab-ce-983a0bba5d2a042c4a3bbb22432ec192c7501d82.tar.gz
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/preferences_helper.rb34
-rw-r--r--app/helpers/projects_helper.rb2
2 files changed, 20 insertions, 16 deletions
diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb
index 8a79217c929..070089d6ef8 100644
--- a/app/helpers/preferences_helper.rb
+++ b/app/helpers/preferences_helper.rb
@@ -9,19 +9,6 @@ module PreferencesHelper
]
end
- # Maps `dashboard` values to more user-friendly option text
- DASHBOARD_CHOICES = {
- projects: _("Your Projects (default)"),
- stars: _("Starred Projects"),
- project_activity: _("Your Projects' Activity"),
- starred_project_activity: _("Starred Projects' Activity"),
- groups: _("Your Groups"),
- todos: _("Your To-Do List"),
- issues: _("Assigned Issues"),
- merge_requests: _("Assigned Merge Requests"),
- operations: _("Operations Dashboard")
- }.with_indifferent_access.freeze
-
# Returns an Array usable by a select field for more user-friendly option text
def dashboard_choices
dashboards = User.dashboards.keys
@@ -31,10 +18,25 @@ module PreferencesHelper
dashboards.map do |key|
# Use `fetch` so `KeyError` gets raised when a key is missing
- [DASHBOARD_CHOICES.fetch(key), key]
+ [localized_dashboard_choices.fetch(key), key]
end
end
+ # Maps `dashboard` values to more user-friendly option text
+ def localized_dashboard_choices
+ {
+ projects: _("Your Projects (default)"),
+ stars: _("Starred Projects"),
+ project_activity: _("Your Projects' Activity"),
+ starred_project_activity: _("Starred Projects' Activity"),
+ groups: _("Your Groups"),
+ todos: _("Your To-Do List"),
+ issues: _("Assigned Issues"),
+ merge_requests: _("Assigned Merge Requests"),
+ operations: _("Operations Dashboard")
+ }.with_indifferent_access.freeze
+ end
+
def project_view_choices
[
['Files and Readme (default)', :files],
@@ -75,9 +77,9 @@ module PreferencesHelper
# Ensure that anyone adding new options updates `DASHBOARD_CHOICES` too
def validate_dashboard_choices!(user_dashboards)
- if user_dashboards.size != DASHBOARD_CHOICES.size
+ if user_dashboards.size != localized_dashboard_choices.size
raise "`User` defines #{user_dashboards.size} dashboard choices," \
- " but `DASHBOARD_CHOICES` defined #{DASHBOARD_CHOICES.size}."
+ " but `localized_dashboard_choices` defined #{localized_dashboard_choices.size}."
end
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index e700f0dbf2a..3d5f22faf68 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -737,3 +737,5 @@ module ProjectsHelper
can?(current_user, :destroy_container_image, project)
end
end
+
+ProjectsHelper.prepend_if_ee('EE::ProjectsHelper')