Class: Redmine::Themes::Theme

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine/themes.rb

Overview

Class used to represent a theme

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Theme

Returns a new instance of Theme


44
45
46
47
48
49
50
# File 'lib/redmine/themes.rb', line 44

def initialize(path)
  @path = path
  @dir = File.basename(path)
  @name = @dir.humanize
  @stylesheets = nil
  @javascripts = nil
end

Instance Attribute Details

#dirObject (readonly)

Returns the value of attribute dir


42
43
44
# File 'lib/redmine/themes.rb', line 42

def dir
  @dir
end

#nameObject (readonly)

Returns the value of attribute name


42
43
44
# File 'lib/redmine/themes.rb', line 42

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path


42
43
44
# File 'lib/redmine/themes.rb', line 42

def path
  @path
end

Instance Method Details

#<=>(theme) ⇒ Object


59
60
61
# File 'lib/redmine/themes.rb', line 59

def <=>(theme)
  name <=> theme.name
end

#==(theme) ⇒ Object


55
56
57
# File 'lib/redmine/themes.rb', line 55

def ==(theme)
  theme.is_a?(Theme) && theme.dir == dir
end

#idObject

Directory name used as the theme id


53
# File 'lib/redmine/themes.rb', line 53

def id; dir end

#javascript_path(source) ⇒ Object


75
76
77
# File 'lib/redmine/themes.rb', line 75

def javascript_path(source)
  "/themes/#{dir}/javascripts/#{source}"
end

#javascriptsObject


67
68
69
# File 'lib/redmine/themes.rb', line 67

def javascripts
  @javascripts ||= assets("javascripts", "js")
end

#stylesheet_path(source) ⇒ Object


71
72
73
# File 'lib/redmine/themes.rb', line 71

def stylesheet_path(source)
  "/themes/#{dir}/stylesheets/#{source}"
end

#stylesheetsObject


63
64
65
# File 'lib/redmine/themes.rb', line 63

def stylesheets
  @stylesheets ||= assets("stylesheets", "css")
end