Skip to content

Commit

Permalink
improving pagination views with css rules used by padrino admin plus …
Browse files Browse the repository at this point in the history
…some more custom classes
  • Loading branch information
igorsantos07 committed Apr 16, 2012
1 parent 748f9cf commit 3141b84
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 83 deletions.
6 changes: 4 additions & 2 deletions app/views/shared/pagination/_brutal.haml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
- (1..total_pages).each do |page|
=link_to page, url(controller, action, params.merge("page" => page))
.pagination
.pages
- (1..total_pages).each do |page|
=link_to page, url(controller, action, params.merge("page" => page))
28 changes: 15 additions & 13 deletions app/views/shared/pagination/_classic.haml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
- if current_page > 1
=link_to "‹ First", url(controller, action, params.merge("page" => 1))
.pagination
- if current_page > 1
=link_to "‹ First", url(controller, action, params.merge("page" => 1)), :class => :first_last

- if previous_page
=link_to "«", url(controller, action, params.merge("page" => previous_page))
- if previous_page
=link_to "«", url(controller, action, params.merge("page" => previous_page)), :class => :prev_next

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

- if next_page
=link_to '»', url(controller, action, params.merge("page" => next_page))
- if next_page
=link_to '»', url(controller, action, params.merge("page" => next_page)), :class => :prev_next

- if last_page
=link_to 'Last ›', url(controller, action, params.merge("page" => last_page))
- if last_page
=link_to 'Last ›', url(controller, action, params.merge("page" => last_page)), :class => :first_last
91 changes: 48 additions & 43 deletions app/views/shared/pagination/_digg.haml
Original file line number Diff line number Diff line change
@@ -1,49 +1,54 @@
- if previous_page
=link_to '« Prev', url(controller, action, params.merge("page" => previous_page))
- else
« Prev
:css
.pagination span.clean { border-width: 0px; }

- if total_pages < 13
- (1..total_pages).each do |page|
- if page == current_page
= page
- else
=link_to page, url(controller, action, params.merge("page" => page))
.pagination
- if previous_page
=link_to '&laquo; Prev', url(controller, action, params.merge("page" => previous_page)), :class => :prev_next
- else
%span.prev_next.clean &laquo; Prev

- elsif current_page < 9
- (1..10).each do |page|
- if page == current_page
= page
- else
=link_to page, url(controller, action, params.merge("page" => page))
&hellip;
=link_to total_pages-1, url(controller, action, params.merge("page" => total_pages)-1)
=link_to total_pages, url(controller, action, params.merge("page" => total_pages))
.pages
- if total_pages < 13
- (1..total_pages).each do |page|
- if page == current_page
%span.current=page
- else
=link_to page, url(controller, action, params.merge("page" => page))

- elsif current_page > total_pages - 8
=link_to 1, url(controller, action, params.merge("page" => 1))
=link_to 2, url(controller, action, params.merge("page" => 2))
&hellip;
- (total_pages-9..total_pages).each do |page|
- if page == current_page
= page
- else
=link_to page, url(controller, action, params.merge("page" => page))
- elsif current_page < 9
- (1..10).each do |page|
- if page == current_page
%span.current=page
- else
=link_to page, url(controller, action, params.merge("page" => page))
%span.clean &hellip;
=link_to total_pages-1, url(controller, action, params.merge("page" => total_pages-1))
=link_to total_pages, url(controller, action, params.merge("page" => total_pages))

- elsif current_page > total_pages - 8
=link_to 1, url(controller, action, params.merge("page" => 1))
=link_to 2, url(controller, action, params.merge("page" => 2))
%span.clean &hellip;
- (total_pages-9..total_pages).each do |page|
- if page == current_page
%span.current=page
- else
=link_to page, url(controller, action, params.merge("page" => page))

- else
=link_to 1, url(controller, action, params.merge("page" => 1))
=link_to 2, url(controller, action, params.merge("page" => 2))
&hellip;
- (current_page-5..current_page+5).each do |page|
- if page == current_page
= page
- else
=link_to page, url(controller, action, params.merge("page" => page))
&hellip;
=link_to total_pages-1, url(controller, action, params.merge("page" => total_pages)-1)
=link_to total_pages, url(controller, action, params.merge("page" => total_pages))
=link_to 1, url(controller, action, params.merge("page" => 1))
=link_to 2, url(controller, action, params.merge("page" => 2))
%span.clean &hellip;
- (current_page-5..current_page+5).each do |page|
- if page == current_page
%span.current=page
- else
=link_to page, url(controller, action, params.merge("page" => page))
%span.clean &hellip;
=link_to total_pages-1, url(controller, action, params.merge("page" => total_pages)-1)
=link_to total_pages, url(controller, action, params.merge("page" => total_pages))

- if next_page
=link_to 'Next &raquo;', url(controller, action, params.merge("page" => next_page))
- else
Next &raquo;
- if next_page
=link_to 'Next &raquo;', url(controller, action, params.merge("page" => next_page)), :class => :prev_next
- else
%span.prev_next.clean Next &raquo;
27 changes: 17 additions & 10 deletions app/views/shared/pagination/_extended.haml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
- if previous_page
=link_to '&laquo; Prev', url(controller, action, params.merge("page" => previous_page))
- else
&laquo; Prev
| Page #{current_page} of #{total_pages}
| items #{current_first_item} &ndash; #{current_last_item} of #{total_items}
:css
.pagination span.clean { border-width: 0px; }

- if next_page
=link_to 'Next &raquo', url(controller, action, params.merge("page" => next_page))
- else
Next &raquo;
.pagination
- if previous_page
=link_to '&laquo; Prev', url(controller, action, params.merge("page" => previous_page)), :class => :prev_next
- else
%span.prev_next.clean &laquo; Prev

.pages
%span.clean
Page #{current_page} of #{total_pages}
| items #{current_first_item} &ndash; #{current_last_item} of #{total_items}

- if next_page
=link_to 'Next &raquo', url(controller, action, params.merge("page" => next_page)), :class => :prev_next
- else
%span.prev_next.clean Next &raquo;
35 changes: 20 additions & 15 deletions app/views/shared/pagination/_punbb.haml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
Pages:
- if current_page > 3
=link_to 1, url(controller, action, params.merge("page" => 1))
- if current_page != 4
&hellip;
:css
.pagination span.clean { border-width: 0px; }

- (current_page-2..current_page+3).each do |page|
- next unless (1..total_pages+1).include? page
- if page == current_page
= page
- else
=link_to page, url(controller, action, params.merge("page" => page))
.pagination
%span.clean
Pages:
- if current_page > 3
=link_to 1, url(controller, action, params.merge("page" => 1))
- if current_page != 4
%span.clean &hellip;

- if current_page <= total_pages-3
- if current_page != total_pages-3
&hellip;
=link_to total_pages, url(controller, action, params.merge("page" => total_pages))
.pages
- (current_page-2..current_page+3).each do |page|
- next unless (1..total_pages+1).include? page
- if page == current_page
%span.current=page
- else
=link_to page, url(controller, action, params.merge("page" => page))

- if current_page <= total_pages-3
- if current_page != total_pages-3
%span.clean &hellip;
=link_to total_pages, url(controller, action, params.merge("page" => total_pages))

0 comments on commit 3141b84

Please sign in to comment.