Class: Compartment::Theme
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Compartment::Theme
- Defined in:
- app/models/compartment/theme.rb
Class Method Summary collapse
- .default ⇒ Object
-
.info {|info| ... } ⇒ Object
used for registering a theme.
Instance Method Summary collapse
Class Method Details
.default ⇒ Object
16 17 18 |
# File 'app/models/compartment/theme.rb', line 16 def self.default Theme.new(:name => 'default') end |
.info {|info| ... } ⇒ Object
used for registering a theme
5 6 7 8 9 |
# File 'app/models/compartment/theme.rb', line 5 def self.info info = Struct.new(:name, :author).new yield(info) Compartment.config.registered_themes << info end |
Instance Method Details
#filepath ⇒ Object
20 21 22 |
# File 'app/models/compartment/theme.rb', line 20 def filepath File.join(Compartment.config.themes_path, name) end |
#path_to_template(template) ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/models/compartment/theme.rb', line 24 def path_to_template(template) case template when :page_not_found, 404 template = 'error_404' end File.join(filepath, 'templates', template) end |
#url ⇒ Object
32 33 34 |
# File 'app/models/compartment/theme.rb', line 32 def url "/assets/themes/#{name}/" end |
#url_to_file(name) ⇒ Object
36 37 38 |
# File 'app/models/compartment/theme.rb', line 36 def url_to_file(name) url + name end |