Commit 89ac9804e846a24f139039074da77a19b36d9239

Authored by Daniela Feitosa
Committed by Thiago Ribeiro
1 parent c3098188

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>
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 => '&laquo; ' + _('Previous'), :next_label => _('Next') + ' &raquo;'}.merge(options) 1134 + options = {:previous_label => content_tag(:span, '&laquo; ', :class => 'previous-arrow') + _('Previous'), :next_label => _('Next') + content_tag(:span, ' &raquo;', :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 => _('&laquo; Newer posts'),  
30 - :next_label => _('Older posts &raquo;'),  
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 => '&laquo; ', :next_label => ' &raquo;', :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 => _('&laquo; Newer posts'),  
16 - :next_label => _('Older posts &raquo;') 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.scss
@@ -1532,7 +1532,7 @@ a.comment-picture { @@ -1532,7 +1532,7 @@ a.comment-picture {
1532 #content .blog-post .publishing-info { 1532 #content .blog-post .publishing-info {
1533 text-align: left; 1533 text-align: left;
1534 } 1534 }
1535 -#content #article .pagination .prev_page { 1535 +#content #article .pagination .previous_page {
1536 position: absolute; 1536 position: absolute;
1537 left: 0; 1537 left: 0;
1538 } 1538 }
@@ -1540,7 +1540,7 @@ a.comment-picture { @@ -1540,7 +1540,7 @@ a.comment-picture {
1540 position: absolute; 1540 position: absolute;
1541 right: 0; 1541 right: 0;
1542 } 1542 }
1543 -.msie6 #content #article .pagination .prev_page, .msie6 #content #article .pagination .next_page { 1543 +.msie6 #content #article .pagination .previous_page, .msie6 #content #article .pagination .next_page {
1544 position: relative; 1544 position: relative;
1545 display: inline; 1545 display: inline;
1546 } 1546 }
@@ -3922,7 +3922,7 @@ table.cms-articles .icon:hover { @@ -3922,7 +3922,7 @@ table.cms-articles .icon:hover {
3922 .image-gallery-item .uploaded-file { 3922 .image-gallery-item .uploaded-file {
3923 background: transparent url('../images/icons-mime/empty.png') no-repeat 50% 43%; 3923 background: transparent url('../images/icons-mime/empty.png') no-repeat 50% 43%;
3924 } 3924 }
3925 -#content #article .image-gallery .pagination .prev_page { 3925 +#content #article .image-gallery .pagination .previous_page {
3926 position: relative; 3926 position: relative;
3927 left: auto; 3927 left: auto;
3928 right: auto; 3928 right: auto;