Created
January 17, 2012 22:44
-
-
Save parndt/1629498 to your computer and use it in GitHub Desktop.
A DSL for defining different page types for Refinery CMS. Allows setting default page parts per type and defining which template shall render when the page is requested.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refinery::Pages.configure do |pages| | |
pages.types do |types| | |
types.define :home do |home| | |
home.parts = %w[intro body] | |
home.template = 'refinery/pages/home' # this is automatic but shows overriding | |
end | |
types.define :show do |show| | |
show.parts = %w[body side] | |
# show.template is automatically 'refinery/pages/show' and thus not required. | |
end | |
types.define :custom do |custom| | |
# can specify a completely different template, but conventions are nicer. | |
custom.template = 'random/other/template' # this would render app/views/random/other/template.html.{erb|haml} | |
custom.parts = %w[header footer body bucket] | |
end | |
# the result of not passing a block is: | |
# types.template = 'refinery/pages/defaults' | |
# types.parts = Refinery::Pages.default_parts | |
types.define :defaults | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The view would look something like: