Commit 6ce76a6eb0139ed5639853763c80e7809018d9e1
Exists in
master
and in
29 other branches
Merge branch 'AI3218_article_block_bug' into 'master'
Ai3218 article block bug Fixing ArticleBlock blog's pagination bug: http://noosfero.org/Development/ActionItem3218 See merge request !301
Showing
2 changed files
with
5 additions
and
3 deletions
Show diff stats
app/helpers/blog_helper.rb
... | ... | @@ -17,13 +17,13 @@ module BlogHelper |
17 | 17 | _('Configure blog') |
18 | 18 | end |
19 | 19 | |
20 | - def list_posts(articles, format = 'full') | |
20 | + def list_posts(articles, format = 'full', paginate = true) | |
21 | 21 | pagination = will_paginate(articles, { |
22 | 22 | :param_name => 'npage', |
23 | 23 | :previous_label => _('« Newer posts'), |
24 | 24 | :next_label => _('Older posts »'), |
25 | 25 | :params => {:action=>"view_page", :page=>articles.first.parent.path.split('/'), :controller=>"content_viewer"} |
26 | - }) if articles.present? | |
26 | + }) if articles.present? && paginate | |
27 | 27 | content = [] |
28 | 28 | artic_len = articles.length |
29 | 29 | articles.each_with_index{ |art,i| | ... | ... |
app/views/content_viewer/blog_page.html.erb
... | ... | @@ -9,13 +9,15 @@ |
9 | 9 | </div> |
10 | 10 | <hr class="pre-posts"/> |
11 | 11 | <div class="blog-posts"> |
12 | + <% paginate = true %> | |
12 | 13 | <%= |
13 | 14 | posts = @posts |
14 | 15 | format = blog.visualization_format |
15 | 16 | if inside_block |
16 | 17 | posts = blog.posts.paginate(:page=>1, :per_page=>inside_block.posts_per_page) |
17 | 18 | format = inside_block.visualization_format |
19 | + paginate = false | |
18 | 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 | 23 | </div> | ... | ... |