Commit 64b98a9ea0ee1ed54adbf3456730101bca04ef43

Authored by Daniela Feitosa
1 parent 9ac9e0ab

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/content/blog.scss
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 #content .blog-post .publishing-info { 34 #content .blog-post .publishing-info {
35 text-align: left; 35 text-align: left;
36 } 36 }
37 -#content #article .pagination .prev_page { 37 +#content #article .pagination .previous_page {
38 position: absolute; 38 position: absolute;
39 left: 0; 39 left: 0;
40 } 40 }
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 position: absolute; 42 position: absolute;
43 right: 0; 43 right: 0;
44 } 44 }
45 -.msie6 #content #article .pagination .prev_page, .msie6 #content #article .pagination .next_page { 45 +.msie6 #content #article .pagination .previous_page, .msie6 #content #article .pagination .next_page {
46 position: relative; 46 position: relative;
47 display: inline; 47 display: inline;
48 } 48 }
public/stylesheets/content/image-gallery.scss
@@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
48 .image-gallery-item .uploaded-file { 48 .image-gallery-item .uploaded-file {
49 background: transparent url('../images/icons-mime/empty.png') no-repeat 50% 43%; 49 background: transparent url('../images/icons-mime/empty.png') no-repeat 50% 43%;
50 } 50 }
51 -#content #article .image-gallery .pagination .prev_page { 51 +#content #article .image-gallery .pagination .previous_page {
52 position: relative; 52 position: relative;
53 left: auto; 53 left: auto;
54 right: auto; 54 right: auto;