Browse files

Show

  • Loading branch information...
1 parent b561974 commit d0e16b05a07eae40dfe3e75ae9e00c76dd8c96dd @porras committed Dec 13, 2008
Showing with 15 additions and 4 deletions.
  1. +1 −1 views/index.mab
  2. +6 −0 views/show.mab
  3. +8 −3 werewolf.rb
View
2 views/index.mab
@@ -1,7 +1,7 @@
div :id => 'links' do
@links.each do |link|
div :class => 'link' do
- p { a link.title, :href => link.url }
+ p { a link.title, :href => "/links/#{link.id}" }
p link.description
end
end
View
6 views/show.mab
@@ -0,0 +1,6 @@
+div :id => 'link' do
+ h2 do
+ a @link.title, :href => @link.url
+ end
+ p @link.description
+end
View
11 werewolf.rb
@@ -14,7 +14,7 @@
end
require 'db/link'
-require 'db/comment'3
+require 'db/comment'
get '/stylesheets/:filename.css' do
content_type 'text/css', :charset => 'utf-8'
@@ -32,6 +32,11 @@
end
post '/links' do
- Link.create(params)
- redirect '/'
+ @link = Link.create(params)
+ redirect "/links/#{@link.id}"
+end
+
+get '/links/:id' do
+ @link = Link[params[:id]]
+ markaby :show
end

0 comments on commit d0e16b0

Please sign in to comment.