Created
May 11, 2009 00:29
-
-
Save dyoder/109804 to your computer and use it in GitHub Desktop.
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
module Pages | |
module Resources | |
class Default | |
include Waves::Resources::Mixin | |
include Pages::ResponseMixin | |
on( :get, [ :resource, { :name => 'home' }] ) { show } | |
# matching against / | |
on( :get, :show => [{ :name => 'home' }] ) { show } | |
on( :post, :add => [ 'admin', :resource ] ) do | |
redirect( paths.edit( model_name, controller.create['key'] ) ) | |
end | |
on( :get, :edit => [ 'admin', :resource, :name ] ) do | |
response.content_type = 'text/html' ; | |
view.editor( singular => controller.find( captured.name ) ) | |
end | |
on( :post, :update => [ 'admin', :resource, :name ] ) do | |
controller.update( captured.name ) and redirect( paths( :site ).admin ) | |
end | |
on( :delete, :delete => [ 'admin', :resource, :name ] ) do | |
controller.delete( captured.name ) and redirect( paths( :site ).admin ) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment