Commit 3b3e024332b41923c8797758d3b0cfbba031e567

Authored by Arthur Esposte
Committed by Fabio Teixeira
1 parent 05d99f0e

Remove paginate from ArticleBlock blog's presentation

(ActionItem3218)

Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com>
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
app/helpers/blog_helper.rb
@@ -17,13 +17,13 @@ module BlogHelper @@ -17,13 +17,13 @@ module BlogHelper
17 _('Configure blog') 17 _('Configure blog')
18 end 18 end
19 19
20 - def list_posts(articles, format = 'full') 20 + def list_posts(articles, format = 'full', paginate = true)
21 pagination = will_paginate(articles, { 21 pagination = will_paginate(articles, {
22 :param_name => 'npage', 22 :param_name => 'npage',
23 :previous_label => _('&laquo; Newer posts'), 23 :previous_label => _('&laquo; Newer posts'),
24 :next_label => _('Older posts &raquo;'), 24 :next_label => _('Older posts &raquo;'),
25 :params => {:action=>"view_page", :page=>articles.first.parent.path.split('/'), :controller=>"content_viewer"} 25 :params => {:action=>"view_page", :page=>articles.first.parent.path.split('/'), :controller=>"content_viewer"}
26 - }) if articles.present? 26 + }) if articles.present? && paginate
27 content = [] 27 content = []
28 artic_len = articles.length 28 artic_len = articles.length
29 articles.each_with_index{ |art,i| 29 articles.each_with_index{ |art,i|
app/views/content_viewer/blog_page.html.erb
@@ -9,13 +9,15 @@ @@ -9,13 +9,15 @@
9 </div> 9 </div>
10 <hr class="pre-posts"/> 10 <hr class="pre-posts"/>
11 <div class="blog-posts"> 11 <div class="blog-posts">
  12 + <% paginate = true %>
12 <%= 13 <%=
13 posts = @posts 14 posts = @posts
14 format = blog.visualization_format 15 format = blog.visualization_format
15 if inside_block 16 if inside_block
16 posts = blog.posts.paginate(:page=>1, :per_page=>inside_block.posts_per_page) 17 posts = blog.posts.paginate(:page=>1, :per_page=>inside_block.posts_per_page)
17 format = inside_block.visualization_format 18 format = inside_block.visualization_format
  19 + paginate = false
18 end 20 end
19 - (blog.empty? ? content_tag('em', _('(no posts)')) : list_posts(posts, format)) 21 + (blog.empty? ? content_tag('em', _('(no posts)')) : list_posts(posts, format, paginate))
20 %> 22 %>
21 </div> 23 </div>