Class: Template
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Template
- Defined in:
- lib/generators/ecm/cms_core/models/templates/template.rb
Defined Under Namespace
Classes: Resolver
Class Method Summary collapse
Instance Method Summary collapse
- #filename ⇒ Object
- #formatted_partial_flag ⇒ Object
- #to_s ⇒ Object
- #update_pathname ⇒ Object
- #update_pathname! ⇒ Object
Class Method Details
.partials ⇒ Object
25 26 27 |
# File 'lib/generators/ecm/cms_core/models/templates/template.rb', line 25 def self.partials where("partial = ?", true) end |
.templates ⇒ Object
29 30 31 |
# File 'lib/generators/ecm/cms_core/models/templates/template.rb', line 29 def self.templates where("partial = ?", false) end |
Instance Method Details
#filename ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/generators/ecm/cms_core/models/templates/template.rb', line 33 def filename if format.blank? "#{basename}.#{locale}.#{handler}" else "#{basename}.#{locale}.#{format}.#{handler}" end end |
#formatted_partial_flag ⇒ Object
41 42 43 |
# File 'lib/generators/ecm/cms_core/models/templates/template.rb', line 41 def formatted_partial_flag I18n.t(self.partial.to_s) end |
#to_s ⇒ Object
45 46 47 |
# File 'lib/generators/ecm/cms_core/models/templates/template.rb', line 45 def to_s "#{self.pathname}#{self.basename}" end |
#update_pathname ⇒ Object
12 13 14 |
# File 'lib/generators/ecm/cms_core/models/templates/template.rb', line 12 def update_pathname self.pathname = self.folder.fullname end |
#update_pathname! ⇒ Object
16 17 18 19 |
# File 'lib/generators/ecm/cms_core/models/templates/template.rb', line 16 def update_pathname! self.update_pathname self.save end |