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
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 |
#favicon ⇒ Object
82 83 84 |
# File 'lib/redmine/themes.rb', line 82 def favicon favicons.first end |
#favicon? ⇒ Boolean
86 87 88 |
# File 'lib/redmine/themes.rb', line 86 def favicon? favicon.present? end |
#favicon_path ⇒ Object
102 103 104 |
# File 'lib/redmine/themes.rb', line 102 def favicon_path "/themes/#{dir}/favicon/#{favicon}" end |
#favicons ⇒ Object
78 79 80 |
# File 'lib/redmine/themes.rb', line 78 def favicons @favicons ||= assets("favicon") end |
#id ⇒ Object
Directory name used as the theme id
56 |
# File 'lib/redmine/themes.rb', line 56 def id; dir end |
#image_path(source) ⇒ Object
94 95 96 |
# File 'lib/redmine/themes.rb', line 94 def image_path(source) "/themes/#{dir}/images/#{source}" end |
#images ⇒ Object
70 71 72 |
# File 'lib/redmine/themes.rb', line 70 def images @images ||= assets("images") end |
#javascript_path(source) ⇒ Object
98 99 100 |
# File 'lib/redmine/themes.rb', line 98 def javascript_path(source) "/themes/#{dir}/javascripts/#{source}" end |
#javascripts ⇒ Object
74 75 76 |
# File 'lib/redmine/themes.rb', line 74 def javascripts @javascripts ||= assets("javascripts", "js") end |
#stylesheet_path(source) ⇒ Object
90 91 92 |
# File 'lib/redmine/themes.rb', line 90 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 |