diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-06-10 04:42:02 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-06-13 17:59:11 -0400 |
commit | 1eb9a02f21d45f2fa301576723bbb0a23b5ba22d (patch) | |
tree | 749c9e8205f023489dfb8bb1d83477787d88194c /app/helpers/preferences_helper.rb | |
parent | 6de3958364f8d2adb68b8beecd53e4af6b17c353 (diff) | |
download | gitlab-ce-1eb9a02f21d45f2fa301576723bbb0a23b5ba22d.tar.gz |
Add a form field to customize the dashboard preference
Diffstat (limited to 'app/helpers/preferences_helper.rb')
-rw-r--r-- | app/helpers/preferences_helper.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index 04873b9bd00..c67a34270ff 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -20,6 +20,25 @@ module PreferencesHelper COLOR_SCHEMES.freeze end + # Populates the dashboard preference select field with more user-friendly + # values. + def dashboard_choices + orig = User.dashboards.keys + + choices = [ + ['Projects (default)', orig[0]], + ['Starred Projects', orig[1]] + ] + + if orig.size != choices.size + # Assure that anyone adding new options updates this method too + raise RuntimeError, "`User` defines #{orig.size} dashboard choices," + + " but #{__method__} defined #{choices.size}" + else + choices + end + end + def user_application_theme theme = Gitlab::Themes.by_id(current_user.try(:theme_id)) theme.css_class |