2012-06-11 13:52:32 -04:00
|
|
|
module Gitlab
|
|
|
|
class Theme
|
2014-07-16 14:12:46 -04:00
|
|
|
BASIC = 1 unless const_defined?(:BASIC)
|
|
|
|
MARS = 2 unless const_defined?(:MARS)
|
|
|
|
MODERN = 3 unless const_defined?(:MODERN)
|
|
|
|
GRAY = 4 unless const_defined?(:GRAY)
|
|
|
|
COLOR = 5 unless const_defined?(:COLOR)
|
2015-03-12 00:29:11 -04:00
|
|
|
BLUE = 6 unless const_defined?(:BLUE)
|
2013-06-20 04:46:54 -04:00
|
|
|
|
2015-04-23 17:30:41 -04:00
|
|
|
def self.classes
|
|
|
|
@classes ||= {
|
|
|
|
BASIC => 'ui_basic',
|
|
|
|
MARS => 'ui_mars',
|
|
|
|
MODERN => 'ui_modern',
|
|
|
|
GRAY => 'ui_gray',
|
|
|
|
COLOR => 'ui_color',
|
|
|
|
BLUE => 'ui_blue'
|
2012-06-11 13:52:32 -04:00
|
|
|
}
|
2015-04-23 17:30:41 -04:00
|
|
|
end
|
2012-06-11 13:52:32 -04:00
|
|
|
|
2015-04-23 17:30:41 -04:00
|
|
|
def self.css_class_by_id(id)
|
2014-01-10 06:58:52 -05:00
|
|
|
id ||= Gitlab.config.gitlab.default_theme
|
2015-04-23 17:30:41 -04:00
|
|
|
classes[id]
|
2012-06-11 13:52:32 -04:00
|
|
|
end
|
2014-12-14 20:01:59 -05:00
|
|
|
|
2015-04-23 17:30:41 -04:00
|
|
|
def self.types
|
|
|
|
@types ||= {
|
2014-12-14 20:01:59 -05:00
|
|
|
BASIC => 'light_theme',
|
|
|
|
MARS => 'dark_theme',
|
|
|
|
MODERN => 'dark_theme',
|
|
|
|
GRAY => 'dark_theme',
|
2015-04-23 17:30:41 -04:00
|
|
|
COLOR => 'dark_theme',
|
|
|
|
BLUE => 'light_theme'
|
2014-12-14 20:01:59 -05:00
|
|
|
}
|
2015-04-23 17:30:41 -04:00
|
|
|
end
|
2014-12-14 20:01:59 -05:00
|
|
|
|
2015-04-23 17:30:41 -04:00
|
|
|
def self.type_css_class_by_id(id)
|
2014-12-14 20:01:59 -05:00
|
|
|
id ||= Gitlab.config.gitlab.default_theme
|
|
|
|
types[id]
|
|
|
|
end
|
2015-04-23 17:30:41 -04:00
|
|
|
|
|
|
|
# Convenience method to get a space-separated String of all the theme
|
2015-04-28 15:42:03 -04:00
|
|
|
# classes that might be applied to the `body` element
|
2015-04-23 17:30:41 -04:00
|
|
|
#
|
|
|
|
# Returns a String
|
|
|
|
def self.body_classes
|
|
|
|
(classes.values + types.values).uniq.join(' ')
|
|
|
|
end
|
2012-06-11 13:52:32 -04:00
|
|
|
end
|
|
|
|
end
|