Skip to content

Commit

Permalink
screenshot urls
Browse files Browse the repository at this point in the history
  • Loading branch information
stefl committed May 21, 2013
1 parent f2ae97b commit f427820
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
compass: bundle exec compass watch
web: bundle exec unicorn -p 4141 -c ./unicorn.rb
worker: bundle exec rake resque:work QUEUE=web
14 changes: 8 additions & 6 deletions app/controllers/hacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
haml :"hacks/index", :layout => !request.xhr?
end

get :show, :map => "/hacks/:slug", :cache => true do
expires_in 5
@hack = Hack.where(:slug => params[:slug]).first
haml :"hacks/show", :layout => !request.xhr?
end

get :sitemap, :map => "/hacks/sitemap", :provides => [:xml], :cache => true do
expires_in 5
@hacks = Hack.all.order_by([[:published_at, :desc]])
Expand All @@ -26,4 +20,12 @@
map.render.gsub("http://sketchingwithcode.com/{:url=>"", "").gsub(""}","")
end

get :show, :map => "/hacks/:slug", :cache => true do
expires_in 5
@hack = Hack.where(:slug => params[:slug]).first
haml :"hacks/show", :layout => !request.xhr?
end



end
2 changes: 1 addition & 1 deletion app/views/hacks/index.haml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- row.each do |hack|
%article.hack{:class=> row.last == hack ? "last" : ""}
.screengrab{:style=>"background-color:hsl(#{hack.hue},50%,75%); border-top: 8px solid hsl(#{hack.hue},50%,75%);"}
- if hack.url && grab = @screengrabs.select {|s| s.slug == hack.url.sub("http://","").gsub(".", "-")}.first
- if hack.url && grab = @screengrabs.select {|s| s.slug == hack.url.sub("http://","").gsub(".", "-").gsub("/","-")}.first
%img{:src=>"/screengrabs/l/#{grab.slug}.jpg"}
%h1
- if hack.url
Expand Down

0 comments on commit f427820

Please sign in to comment.