Commit 596f9f4877b4cc618ad6050aa2c3671581bf3f07
Committed by
Antonio Terceiro
1 parent
e5baee61
Exists in
stable-1.2
Improve pagination default
Also %s/will_paginate/pagination_links to use the default on forum, blog and cms Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br> Signed-off-by: Melissa Wen <melissa@colivre.coop.br> Signed-off-by: Antonio Terceiro <terceiro@colivre.coop.br> (cherry picked from commit 64b98a9ea0ee1ed54adbf3456730101bca04ef43; required porting the CSS changes back to the huge application.css present in 1.2)
Showing
5 changed files
with
7 additions
and
16 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -1131,7 +1131,7 @@ module ApplicationHelper | @@ -1131,7 +1131,7 @@ module ApplicationHelper | ||
1131 | alias :browse_communities_menu :search_communities_menu | 1131 | alias :browse_communities_menu :search_communities_menu |
1132 | 1132 | ||
1133 | def pagination_links(collection, options={}) | 1133 | def pagination_links(collection, options={}) |
1134 | - options = {:previous_label => '« ' + _('Previous'), :next_label => _('Next') + ' »'}.merge(options) | 1134 | + options = {:previous_label => content_tag(:span, '« ', :class => 'previous-arrow') + _('Previous'), :next_label => _('Next') + content_tag(:span, ' »', :class => 'next-arrow'), :inner_window => 1, :outer_window => 0 }.merge(options) |
1135 | will_paginate(collection, options) | 1135 | will_paginate(collection, options) |
1136 | end | 1136 | end |
1137 | 1137 |
app/helpers/blog_helper.rb
@@ -24,10 +24,8 @@ module BlogHelper | @@ -24,10 +24,8 @@ module BlogHelper | ||
24 | end | 24 | end |
25 | 25 | ||
26 | def list_posts(articles, conf = { format: 'full', paginate: true }) | 26 | def list_posts(articles, conf = { format: 'full', paginate: true }) |
27 | - pagination = will_paginate(articles, { | 27 | + pagination = pagination_links(articles, { |
28 | :param_name => 'npage', | 28 | :param_name => 'npage', |
29 | - :previous_label => _('« Newer posts'), | ||
30 | - :next_label => _('Older posts »'), | ||
31 | :params => {:action=>"view_page", | 29 | :params => {:action=>"view_page", |
32 | :page=>articles.first.parent.path.split('/'), | 30 | :page=>articles.first.parent.path.split('/'), |
33 | :controller=>"content_viewer"} | 31 | :controller=>"content_viewer"} |
app/helpers/cms_helper.rb
@@ -9,11 +9,6 @@ module CmsHelper | @@ -9,11 +9,6 @@ module CmsHelper | ||
9 | mime_type.gsub('/', '_').gsub('-', '') | 9 | mime_type.gsub('/', '_').gsub('-', '') |
10 | end | 10 | end |
11 | 11 | ||
12 | - def pagination_links(collection, options={}) | ||
13 | - options = {:previous_label => '« ', :next_label => ' »', :page_links => false}.merge(options) | ||
14 | - will_paginate(collection, options) | ||
15 | - end | ||
16 | - | ||
17 | attr_reader :environment | 12 | attr_reader :environment |
18 | 13 | ||
19 | def options_for_article(article, tokenized_children=nil) | 14 | def options_for_article(article, tokenized_children=nil) |
app/helpers/forum_helper.rb
@@ -10,10 +10,8 @@ module ForumHelper | @@ -10,10 +10,8 @@ module ForumHelper | ||
10 | end | 10 | end |
11 | 11 | ||
12 | def list_forum_posts(articles) | 12 | def list_forum_posts(articles) |
13 | - pagination = will_paginate(articles, { | ||
14 | - :param_name => 'npage', | ||
15 | - :previous_label => _('« Newer posts'), | ||
16 | - :next_label => _('Older posts »') | 13 | + pagination = pagination_links(articles, { |
14 | + :param_name => 'npage' | ||
17 | }) | 15 | }) |
18 | content = [content_tag('tr', | 16 | content = [content_tag('tr', |
19 | content_tag('th', _('Discussion topic')) + | 17 | content_tag('th', _('Discussion topic')) + |
public/stylesheets/application.css
@@ -1530,7 +1530,7 @@ a.comment-picture { | @@ -1530,7 +1530,7 @@ a.comment-picture { | ||
1530 | #content .blog-post .publishing-info { | 1530 | #content .blog-post .publishing-info { |
1531 | text-align: left; | 1531 | text-align: left; |
1532 | } | 1532 | } |
1533 | -#content #article .pagination .prev_page { | 1533 | +#content #article .pagination .previous_page { |
1534 | position: absolute; | 1534 | position: absolute; |
1535 | left: 0; | 1535 | left: 0; |
1536 | } | 1536 | } |
@@ -1538,7 +1538,7 @@ a.comment-picture { | @@ -1538,7 +1538,7 @@ a.comment-picture { | ||
1538 | position: absolute; | 1538 | position: absolute; |
1539 | right: 0; | 1539 | right: 0; |
1540 | } | 1540 | } |
1541 | -.msie6 #content #article .pagination .prev_page, .msie6 #content #article .pagination .next_page { | 1541 | +.msie6 #content #article .pagination .previous_page, .msie6 #content #article .pagination .next_page { |
1542 | position: relative; | 1542 | position: relative; |
1543 | display: inline; | 1543 | display: inline; |
1544 | } | 1544 | } |
@@ -3926,7 +3926,7 @@ table.cms-articles .icon:hover { | @@ -3926,7 +3926,7 @@ table.cms-articles .icon:hover { | ||
3926 | .image-gallery-item .uploaded-file { | 3926 | .image-gallery-item .uploaded-file { |
3927 | background: transparent url('../images/icons-mime/empty.png') no-repeat 50% 43%; | 3927 | background: transparent url('../images/icons-mime/empty.png') no-repeat 50% 43%; |
3928 | } | 3928 | } |
3929 | -#content #article .image-gallery .pagination .prev_page { | 3929 | +#content #article .image-gallery .pagination .previous_page { |
3930 | position: relative; | 3930 | position: relative; |
3931 | left: auto; | 3931 | left: auto; |
3932 | right: auto; | 3932 | right: auto; |