This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
tuxbliki/app/views/shared/_pagination_links.html.erb

25 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2008-06-27 21:28:18 -04:00
<% if @page_count > 0 -%>
<div id="pagination_links">
<% if @page > 0 -%>
<a href="<%= url(@url_key, :page => 0, :id => @paginate_id) -%>"><img src="/images/go-first.png" alt="First Page" /></a> <a href="<%= url(@url_key, :page => @page - 1, :id => @paginate_id) -%>"><img src="/images/go-previous.png" alt="Previous Page" /></a>
2008-06-27 21:28:18 -04:00
<% end -%>
<% if @page_count > 1 -%>
<% (@page - 5).upto(@page - 1) do |i| ; next if i < 0 -%>
<a href="<%= url(@url_key, :page => i, :id => @paginate_id) -%>"><%= i + 1 -%></a>
2008-06-27 21:28:18 -04:00
<% end %>
<%= @page + 1 %>
<% (@page + 1).upto(@page + 5) do |i| ; next if i >= @page_count -%>
<a href="<%= url(@url_key, :page => i, :id => @paginate_id) -%>"><%= i + 1 -%></a>
2008-06-27 21:28:18 -04:00
<% end %>
<% if @page < @page_count - 1 -%>
<a href="<%= url(@url_key, :page => @page + 1, :id => @paginate_id) -%>"><img src="/images/go-next.png" alt="Next Page" /></a> <a href="<%= url(@url_key, :page => @page_count - 1, :id => @paginate_id) -%>"><img src="/images/go-last.png" alt="Last Page" /></a>
2008-06-27 21:28:18 -04:00
<% end -%>
<% end -%>
</div>
<% end -%>