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
- #favicon ⇒ Object
- #favicon? ⇒ Boolean
- #favicon_path ⇒ Object
- #favicons ⇒ Object
-
#id ⇒ Object
Directory name used as the theme id.
- #image_path(source) ⇒ Object
- #images ⇒ Object
-
#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.
48 49 50 51 52 53 54 |
# File 'lib/redmine/themes.rb', line 48 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.
46 47 48 |
# File 'lib/redmine/themes.rb', line 46 def dir @dir end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
46 47 48 |
# File 'lib/redmine/themes.rb', line 46 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
46 47 48 |
# File 'lib/redmine/themes.rb', line 46 def path @path end |
Instance Method Details
#<=>(theme) ⇒ Object
63 64 65 |
# File 'lib/redmine/themes.rb', line 63 def <=>(theme) name <=> theme.name end |
#==(theme) ⇒ Object
59 60 61 |
# File 'lib/redmine/themes.rb', line 59 def ==(theme) theme.is_a?(Theme) && theme.dir == dir end |
#favicon ⇒ Object
83 84 85 |
# File 'lib/redmine/themes.rb', line 83 def favicon favicons.first end |
#favicon? ⇒ Boolean
87 88 89 |
# File 'lib/redmine/themes.rb', line 87 def favicon? favicon.present? end |
#favicon_path ⇒ Object
103 104 105 |
# File 'lib/redmine/themes.rb', line 103 def favicon_path "/themes/#{dir}/favicon/#{favicon}" end |
#favicons ⇒ Object
79 80 81 |
# File 'lib/redmine/themes.rb', line 79 def favicons @favicons ||= assets("favicon") end |
#id ⇒ Object
Directory name used as the theme id
57 |
# File 'lib/redmine/themes.rb', line 57 def id; dir end |
#image_path(source) ⇒ Object
95 96 97 |
# File 'lib/redmine/themes.rb', line 95 def image_path(source) "/themes/#{dir}/images/#{source}" end |
#images ⇒ Object
71 72 73 |
# File 'lib/redmine/themes.rb', line 71 def images @images ||= assets("images") end |
#javascript_path(source) ⇒ Object
99 100 101 |
# File 'lib/redmine/themes.rb', line 99 def javascript_path(source) "/themes/#{dir}/javascripts/#{source}" end |
#javascripts ⇒ Object
75 76 77 |
# File 'lib/redmine/themes.rb', line 75 def javascripts @javascripts ||= assets("javascripts", "js") end |
#stylesheet_path(source) ⇒ Object
91 92 93 |
# File 'lib/redmine/themes.rb', line 91 def stylesheet_path(source) "/themes/#{dir}/stylesheets/#{source}" end |
#stylesheets ⇒ Object
67 68 69 |
# File 'lib/redmine/themes.rb', line 67 def stylesheets @stylesheets ||= assets("stylesheets", "css") end |