Skip to content
This repository has been archived by the owner on Oct 20, 2020. It is now read-only.

Commit

Permalink
fix pagination after page 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Dec 7, 2010
1 parent fbe19ce commit c3c70e7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app.rb
Expand Up @@ -79,6 +79,10 @@ def absolute_url(path)

abs_uri << path
end

def root_path?
request.path == '/'
end
end

get '/' do
Expand Down Expand Up @@ -181,7 +185,7 @@ def absolute_url(path)
%link{ href: "/screen.css", rel: "stylesheet" }
- if @user
%link{ href: "#{request.path}.atom", rel: 'alternate', title: "#{@user.username}'s photos", type: 'application/atom+xml' }
- elsif request.path == '/'
- elsif root_path?
%link{ href: "/popular.atom", rel: 'alternate', title: @title, type: 'application/atom+xml' }
%script{ src: "/zepto.min.js" }

Expand All @@ -193,7 +197,7 @@ def absolute_url(path)
- if @user
%img{ src: @user.avatar, class: 'avatar' }
= instalink @title
- if request.path == '/'
- if root_path?
%a{ href: "/popular.atom", class: 'feed' }
%img{ src: '/feed.png', alt: 'feed' }
- if @user
Expand Down Expand Up @@ -257,7 +261,7 @@ def absolute_url(path)
%a{ href: "/users/#{photo.user.id}" }&= photo.user.full_name
.close
%a{ href: "#close" } close
- if @user and @photos.length >= 20
- if @photos.length >= 20 and not root_path?
%li.pagination
%a{ href: request.path + "?max_id=#{@photos.last.id}" } <span>Load more &rarr;</span>

Expand Down

0 comments on commit c3c70e7

Please sign in to comment.