Skip to content

Commit

Permalink
pagination improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
neverhood committed Apr 29, 2013
1 parent 7f9bd51 commit 87d42aa
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion views/bootstrap_classic_safe.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,26 @@
%li
=link_to "«".html_safe, url(controller, action, params.merge("page" => previous_page)), :class => :prev_next

- (1..total_pages).each do |page|
- if current_page > 2
- pages = (current_page + 5 >= total_pages) ? ((current_page - 2)..total_pages) : ((current_page - 2)..(current_page + 5))
- else
- pages = (1..(total_pages > 5 ? 5 : total_pages))

- if current_page > 3
%li
%span.current='...'

- pages.each do |page|
%li
- if page == current_page
%span.current=page
- else
=link_to page.to_s.html_safe, url(controller, action, params.merge("page" => page))

- if current_page + 5 < total_pages
%li
%span.current='...'

- if next_page
%li
=link_to "&raquo;".html_safe, url(controller, action, params.merge("page" => next_page)), :class => :prev_next
Expand Down

0 comments on commit 87d42aa

Please sign in to comment.