diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-04-27 07:36:42 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-04-27 07:36:42 +0000 |
commit | 6de7f94f00eb790def76b0fea15830180e25a0cb (patch) | |
tree | b029b326003af97355a4518d5533cbd707c463dd /lib | |
parent | a64b5e3c60ab1fe295a397422750e026c35aae97 (diff) | |
parent | 1e1785cc1699f33e4c1f98cde71fc19d1be10d6a (diff) | |
download | gitlab-ce-6de7f94f00eb790def76b0fea15830180e25a0cb.tar.gz |
Merge branch 'rs-minor-styles' into 'master'
Minor design change grab-bag :tada:
I started with one simple change and found a few more, so here they are.
### Simplify icon style selectors
All FontAwesome icons have an `fa` class, so just use that.
### Don't override color of code blocks in notes
This was a pet peeve of mine.
| Before | After |
|:------:|:-----:|
| ![Screen_Shot_2015-04-23_at_4.14.23_PM](https://gitlab.com/gitlab-org/gitlab-ce/uploads/c77cb0816bf0f05cb8c4105cdd8b3ec6/Screen_Shot_2015-04-23_at_4.14.23_PM.png) | ![Screen_Shot_2015-04-23_at_4.15.44_PM](https://gitlab.com/gitlab-org/gitlab-ce/uploads/463c1d2052e12444563f5e2c102ac51e/Screen_Shot_2015-04-23_at_4.15.44_PM.png) |
### Items with tooltips don't need a 'data-original-title' attribute
This attribute gets added dynamically by Bootstrap's tooltip JS based on the `title` attribute
### Fix Profile > Design live-updating
`ui_blue` wasn't added to the list of classes to remove, so if a user changed to that theme, any subsequent changes wouldn't be live-updated.
This change refactors Gitlab::Theme a bit to make it harder for this to happen in the future with new themes.
### Remove the `has_bottom_tooltip` class
Bootstrap's tooltip JS can read the placement from a `data-placement` attribute.
Further, when we supply the `selector` option to `tooltip`, tooltips will be added to any dynamically-added elements matching the selector, without us having to re-call the `tooltip` method.
See merge request !569
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/theme.rb | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/lib/gitlab/theme.rb b/lib/gitlab/theme.rb index 43093c7d27e..f0e61aa2e81 100644 --- a/lib/gitlab/theme.rb +++ b/lib/gitlab/theme.rb @@ -7,33 +7,44 @@ module Gitlab COLOR = 5 unless const_defined?(:COLOR) BLUE = 6 unless const_defined?(:BLUE) - def self.css_class_by_id(id) - themes = { - BASIC => "ui_basic", - MARS => "ui_mars", - MODERN => "ui_modern", - GRAY => "ui_gray", - COLOR => "ui_color", - BLUE => "ui_blue" + def self.classes + @classes ||= { + BASIC => 'ui_basic', + MARS => 'ui_mars', + MODERN => 'ui_modern', + GRAY => 'ui_gray', + COLOR => 'ui_color', + BLUE => 'ui_blue' } + end + def self.css_class_by_id(id) id ||= Gitlab.config.gitlab.default_theme - - themes[id] + classes[id] end - def self.type_css_class_by_id(id) - types = { + def self.types + @types ||= { BASIC => 'light_theme', MARS => 'dark_theme', MODERN => 'dark_theme', GRAY => 'dark_theme', - COLOR => 'dark_theme' + COLOR => 'dark_theme', + BLUE => 'light_theme' } + end + def self.type_css_class_by_id(id) id ||= Gitlab.config.gitlab.default_theme - types[id] end + + # Convenience method to get a space-separated String of all the theme + # classes that mighty be applied to the `body` element + # + # Returns a String + def self.body_classes + (classes.values + types.values).uniq.join(' ') + end end end |