summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-06-05 15:50:36 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-06-13 17:58:16 -0400
commit844d72716e2175dcd5e39b4d1eecb9e3560aa0b9 (patch)
tree0df35c04333f7fb8dd970f0c984251952525663a /app
parent658b42b1fa79c77b1acef67a645b36a2928a71bd (diff)
downloadgitlab-ce-844d72716e2175dcd5e39b4d1eecb9e3560aa0b9.tar.gz
Add Gitlab::Themes module; remove Gitlab::Theme
Now we can simply loop through all themes, among other things. This also removes the `dark_theme` / `light_theme` classes and the `theme_type` helper, since they weren't used anywhere.
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/pages/profiles/preferences.scss7
-rw-r--r--app/helpers/application_helper.rb7
-rw-r--r--app/views/profiles/preferences/show.html.haml35
-rw-r--r--app/views/profiles/preferences/update.js.erb4
4 files changed, 12 insertions, 41 deletions
diff --git a/app/assets/stylesheets/pages/profiles/preferences.scss b/app/assets/stylesheets/pages/profiles/preferences.scss
index 846a940f1c9..e8c80362817 100644
--- a/app/assets/stylesheets/pages/profiles/preferences.scss
+++ b/app/assets/stylesheets/pages/profiles/preferences.scss
@@ -3,11 +3,12 @@
margin-right: 20px;
text-align: center;
- .application-theme-preview {
+ .preview {
+ @include border-radius(4px);
+
height: 80px;
- width: 160px;
margin-bottom: 10px;
- @include border-radius(4px);
+ width: 160px;
&.ui_blue {
background: $theme-blue;
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index a539ec49f7a..62794bc5f4c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -139,11 +139,8 @@ module ApplicationHelper
end
def app_theme
- Gitlab::Theme.css_class_by_id(current_user.try(:theme_id))
- end
-
- def theme_type
- Gitlab::Theme.type_css_class_by_id(current_user.try(:theme_id))
+ theme = Gitlab::Themes.by_id(current_user.try(:theme_id))
+ theme.css_class
end
def user_color_scheme_class
diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml
index 2fc47227c38..a30f302dea7 100644
--- a/app/views/profiles/preferences/show.html.haml
+++ b/app/views/profiles/preferences/show.html.haml
@@ -10,38 +10,11 @@
.panel-heading
Application theme
.panel-body
- .themes_opts
+ - Gitlab::Themes.each do |theme|
= label_tag do
- .prev.default
- = f.radio_button :theme_id, 1
- Graphite
-
- = label_tag do
- .prev.classic
- = f.radio_button :theme_id, 2
- Charcoal
-
- = label_tag do
- .prev.modern
- = f.radio_button :theme_id, 3
- Green
-
- = label_tag do
- .prev.gray
- = f.radio_button :theme_id, 4
- Gray
-
- = label_tag do
- .prev.violet
- = f.radio_button :theme_id, 5
- Violet
-
- = label_tag do
- .prev.blue
- = f.radio_button :theme_id, 6
- Blue
- %br
- .clearfix
+ .preview{class: theme.css_class}
+ = f.radio_button :theme_id, theme.id
+ = theme.name
.panel.panel-default.code-preview-theme
.panel-heading
diff --git a/app/views/profiles/preferences/update.js.erb b/app/views/profiles/preferences/update.js.erb
index db37619136d..830df228557 100644
--- a/app/views/profiles/preferences/update.js.erb
+++ b/app/views/profiles/preferences/update.js.erb
@@ -1,3 +1,3 @@
// Remove body class for any previous theme, re-add current one
-$('body').removeClass('<%= Gitlab::Theme.body_classes %>')
-$('body').addClass('<%= app_theme %> <%= theme_type %>')
+$('body').removeClass('<%= Gitlab::Themes.body_classes %>')
+$('body').addClass('<%= app_theme %>')