Permalink
Browse files

Get rid of @mode variable, figure out route directly.

  • Loading branch information...
1 parent 5dc51cc commit 476954812d786570c3ed2d8e714fad253b1311e5 @funkaoshi committed Jul 20, 2010
Showing with 4 additions and 5 deletions.
  1. +4 −5 groupviewer.rb
View
9 groupviewer.rb
@@ -71,7 +71,6 @@ def load_group(group, page)
halt 404
end
@list = ImageListing.new(group, group_info.name, page.to_i, photos.pages, build_sequence(photos))
- @mode = "group"
end
# Loads 30 medium images from a flickr user
@@ -85,7 +84,6 @@ def load_favs(user_name, page)
halt 404
end
@list = ImageListing.new(user_name, "#{user_name}'s Favourites", page.to_i, photos.pages, build_sequence(photos))
- @mode = "favs"
end
# build list of images.
@@ -97,20 +95,21 @@ def build_sequence(photos)
end
def nav_links
+ mode = request.path_info.split('/')[1]
next_link =
if @list.page == @list.pages
"Next"
else
- "<a class='next_page' href='/#{@mode}/#{@list.flickr_id}?pg=#{@list.page+1}'>Next</a>"
+ "<a class='next_page' href='/#{mode}/#{@list.flickr_id}?pg=#{@list.page+1}'>Next</a>"
end
prev_link =
case @list.page
when 1
"Prev"
when 2
- "<a class='prev_page' href='/#{@mode}/#{@list.flickr_id}'>Prev</a>"
+ "<a class='prev_page' href='/#{mode}/#{@list.flickr_id}'>Prev</a>"
else
- "<a class='prev_page' href='/#{@mode}/#{@list.flickr_id}?pg=#{@list.page-1}'>Prev</a>"
+ "<a class='prev_page' href='/#{mode}/#{@list.flickr_id}?pg=#{@list.page-1}'>Prev</a>"
end
"#{prev_link} | #{@list.page} of #{@list.pages} | #{next_link}"
end

0 comments on commit 4769548

Please sign in to comment.