Module: Cms::Configuration::ConfigurableTemplate
- Defined in:
- lib/cms/configuration/configurable_template.rb
Overview
Handles content that has configurable templates. Use the following rails configuration:
config.cms.templates['cms/form'] = 'my-form-layout'
config.cms.templates['cms/sites/sessions_controller'] = :subpage
Instance Method Summary collapse
-
#normalize_layout(klass, explicit_template) ⇒ Object
Given a class name return a layout file path.
Instance Method Details
#normalize_layout(klass, explicit_template) ⇒ Object
Given a class name return a layout file path. Looks in app.config.cms.templates first, then for the explicit_template
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cms/configuration/configurable_template.rb', line 12 def normalize_layout(klass, explicit_template) found = Rails.configuration.cms.templates[klass.name.underscore] if found "templates/#{found}" elsif explicit_template "templates/#{explicit_template}" else "templates/default" end end |