dyoder (owner)

Revisions

gist: 120257 Download_button fork
public
Public Clone URL: git://gist.github.com/120257.git
rest_foundation.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
representation "text/html", "application/xhtml+xml" do
  transitions do
    view "Edit page", Site/Page/URL, "application/vnd.com.example.wiki.page.editable"
 
    view "View raw contents", Site/Page/URL, "text/plain"
    view "Show page history", Site/History/URL
    view "Other pages under #{path}", Site/Pages/path
  end
 
  response_is("text/html") { processor.call request }
 
  rendered_by Hoshi, :from => "p/page.rb"
end
 
representation "application/vnd.com.example.wiki.page.editable" do
  transitions do
    view "Cancel Editing", Site/Page/URL # GET default MIME
    view "View raw contents", Site/Page/URL, "text/plain"
    view "Show page history", Site/History/URL
    view "Other pages under #{path}", Site/Pages/path
    delete "Delete This Page", Site/Page/URL # DELETE
    update "Commit Your Changes", Site/Page/URL # POST
  end
 
  response_is("text/html") { processor.call request }
  rendered_by Hoshi, :from => "p/editable_page.rb"
 
end