Class: Redmine::Themes::Theme
- Inherits:
-
Object
- Object
- Redmine::Themes::Theme
- Defined in:
- lib/redmine/themes.rb
Overview
Class used to represent a theme
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #<=>(theme) ⇒ Object
- #==(theme) ⇒ Object
-
#id ⇒ Object
Directory name used as the theme id.
-
#initialize(path) ⇒ Theme
constructor
A new instance of Theme.
- #javascript_path(source) ⇒ Object
- #javascripts ⇒ Object
- #stylesheet_path(source) ⇒ Object
- #stylesheets ⇒ Object
Constructor Details
#initialize(path) ⇒ Theme
Returns a new instance of Theme.
47 48 49 50 51 52 53 |
# File 'lib/redmine/themes.rb', line 47 def initialize(path) @path = path @dir = File.basename(path) @name = @dir.humanize @stylesheets = nil @javascripts = nil end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
45 46 47 |
# File 'lib/redmine/themes.rb', line 45 def dir @dir end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
45 46 47 |
# File 'lib/redmine/themes.rb', line 45 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
45 46 47 |
# File 'lib/redmine/themes.rb', line 45 def path @path end |
Instance Method Details
#<=>(theme) ⇒ Object
62 63 64 |
# File 'lib/redmine/themes.rb', line 62 def <=>(theme) name <=> theme.name end |
#==(theme) ⇒ Object
58 59 60 |
# File 'lib/redmine/themes.rb', line 58 def ==(theme) theme.is_a?(Theme) && theme.dir == dir end |
#id ⇒ Object
Directory name used as the theme id
56 |
# File 'lib/redmine/themes.rb', line 56 def id; dir end |
#javascript_path(source) ⇒ Object
78 79 80 |
# File 'lib/redmine/themes.rb', line 78 def javascript_path(source) "/themes/#{dir}/javascripts/#{source}" end |
#javascripts ⇒ Object
70 71 72 |
# File 'lib/redmine/themes.rb', line 70 def javascripts @javascripts ||= assets("javascripts", "js") end |
#stylesheet_path(source) ⇒ Object
74 75 76 |
# File 'lib/redmine/themes.rb', line 74 def stylesheet_path(source) "/themes/#{dir}/stylesheets/#{source}" end |
#stylesheets ⇒ Object
66 67 68 |
# File 'lib/redmine/themes.rb', line 66 def stylesheets @stylesheets ||= assets("stylesheets", "css") end |