-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improving pagination views with css rules used by padrino admin plus …
…some more custom classes
- Loading branch information
1 parent
748f9cf
commit 3141b84
Showing
5 changed files
with
104 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '« Prev', url(controller, action, params.merge("page" => previous_page)), :class => :prev_next | ||
- else | ||
%span.prev_next.clean « 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)) | ||
… | ||
=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)) | ||
… | ||
- (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 … | ||
=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 … | ||
- (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)) | ||
… | ||
- (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)) | ||
… | ||
=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 … | ||
- (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 … | ||
=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 »', url(controller, action, params.merge("page" => next_page)) | ||
- else | ||
Next » | ||
- if next_page | ||
=link_to 'Next »', url(controller, action, params.merge("page" => next_page)), :class => :prev_next | ||
- else | ||
%span.prev_next.clean Next » |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
- if previous_page | ||
=link_to '« Prev', url(controller, action, params.merge("page" => previous_page)) | ||
- else | ||
« Prev | ||
| Page #{current_page} of #{total_pages} | ||
| items #{current_first_item} – #{current_last_item} of #{total_items} | ||
:css | ||
.pagination span.clean { border-width: 0px; } | ||
|
||
- if next_page | ||
=link_to 'Next »', url(controller, action, params.merge("page" => next_page)) | ||
- else | ||
Next » | ||
.pagination | ||
- if previous_page | ||
=link_to '« Prev', url(controller, action, params.merge("page" => previous_page)), :class => :prev_next | ||
- else | ||
%span.prev_next.clean « Prev | ||
|
||
.pages | ||
%span.clean | ||
Page #{current_page} of #{total_pages} | ||
| items #{current_first_item} – #{current_last_item} of #{total_items} | ||
|
||
- if next_page | ||
=link_to 'Next »', url(controller, action, params.merge("page" => next_page)), :class => :prev_next | ||
- else | ||
%span.prev_next.clean Next » |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
… | ||
: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 … | ||
|
||
- if current_page <= total_pages-3 | ||
- if current_page != total_pages-3 | ||
… | ||
=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 … | ||
=link_to total_pages, url(controller, action, params.merge("page" => total_pages)) |