Skip to content

Instantly share code, notes, and snippets.

@lukesutton
Created October 13, 2008 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukesutton/16521 to your computer and use it in GitHub Desktop.
Save lukesutton/16521 to your computer and use it in GitHub Desktop.
# This allows users to publish the path to the public pages
Merb::Router.extensions do
def gluttonberg_pages(prefix = nil)
path = prefix ? "/#{prefix}/:path" : "/:path"
match(path, :path => /\S+/).
to(:controller => "gluttonberg/content/public", :action => "show").
name(:gluttonberg_public_page)
end
end
scope.identify DataMapper::Resource => :id do |s|
# Controllers in the content module
s.match("/content").to(:controller => "content/main").name(:content)
s.match("/content") do |c|
c.resources(:pages, :controller => "content/pages") do |p|
p.match("/localizations/:id").to(:controller => "content/page_localizations") do |l|
l.match("/edit").to(:action => "edit").name(:edit_localization)
l.match(:method => "put").to(:action => "update")
end.name(:localization)
end
c.resources(:templates, :controller => "content/templates") do |t|
t.resources(:sections, :controller => "content/template_sections")
end
end
# Top level controllers
s.resources(:locales)
s.resources(:dialects)
# Asset Library
s.match("/library").to(:controller => "library/main").name(:library)
s.match("/library") do |a|
a.resources(:assets, :controller => "library/assets")
a.resources(:collections, :controller => "library/collections")
end
# Users
s.match("/users").to(:controller => "users").name(:users)
# Settings
s.match("/settings").to(:controller => "settings").name(:settings)
s.gluttonberg_pages("public") if Gluttonberg.standalone?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment