Skip to content

Instantly share code, notes, and snippets.

@lukesutton
Created December 1, 2008 04:21
Show Gist options
  • Select an option

  • Save lukesutton/30619 to your computer and use it in GitHub Desktop.

Select an option

Save lukesutton/30619 to your computer and use it in GitHub Desktop.
Gluttonberg::PageDescriptions.describe do
# The key is how this description will be refered to internally. The value
# is the label, which will be used within the UI.
page :home => "Homepage" do
# A description, which will be displayed in the user interface if the
# user requests it.
desc "The home page of the site"
# Limit the number of pages that can be be associatied with this
# description. It can be an Integer between 1—n or it can be a range
# between 1..n
limit 1
# The name of the template — excluding locale, dialect or format.
# Gluttonberg and Merb can figure that out between themselves. If the
# template is in a sub-dir, just append that to the front of the name.
template "home"
# This describes a section within the page. Where there are multiple
# sections, their order in the admin UI is implicit — they appear in the
# same order they were declared.
section :main,
:label => "Main",
:desc => "Where you put the news ain't it.",
:type => :rich_text_content
# A section may also have additional constraints, say the number of
# elements of the specified type in this section — defaults to one.
#
# Particular content types also have their own constraints. Images may
# be constrained by kind or by size.
section :images,
:label => "Favourite images",
:desc => "The latest pictures that you like the most.",
:type => :rich_text_content,
:count => (2..6),
:size => [100, 200],
:kind => [:gif, :jpg, :png]
end
# Descriptions can also be used to link a page to a custom controller. In
# this example the associated page will have it's requests sent to the
# specified route.
#
# Note that template is omitted, since this comes from inside the slice —
# and may be over-written within the app if needed.
page :forum => "Forum" do
desc "A forum slice for your site."
limit 1
layout "default"
rewrite :public_forum
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment