Permalink
Browse files

got it showing old revisions

  • Loading branch information...
1 parent 27df62a commit 85371cd97371e8fb538494eb46e0a76722a125c0 @benatkin committed Feb 12, 2009
Showing with 20 additions and 5 deletions.
  1. +3 −3 views/disambiguation.haml
  2. +1 −0 views/show.haml
  3. +16 −2 weaky.rb
@@ -1,6 +1,6 @@
%p
There are several pages named
%b= @items.first.name
- - @items.each do |item|
- %p
- %a{ :href => item.id_url }= item.id
+- @items.each do |item|
+ %p
+ %a{ :href => item.id_url }= item.id
View
@@ -1,5 +1,6 @@
#admin
%p
%a{ :href => @item.edit_url } edit
+ %a{ :href => @item.revs_url } revisions
#item
= @item.body_html
View
@@ -37,8 +37,12 @@ def url
'/' + name
end
- def id_url
- '/id/' + id
+ def id_url(rev = nil)
+ "/id/#{id}" + (rev ? "/#{rev}" : "")
+ end
+
+ def revs_url
+ "/revs/#{id}"
end
def edit_url
@@ -86,6 +90,16 @@ def delete_url
haml :show
end
+get '/id/:id/:rev' do
+ @item = Item.get(params[:id], params[:rev])
+ haml :show
+end
+
+get '/revs/:id' do
+ @item = Item.get(params[:id], true)
+ haml :revisions
+end
+
get '/edit/:id' do
@item = Item.get(params[:id])
@action = @item.id_url

0 comments on commit 85371cd

Please sign in to comment.