From 3b3e024332b41923c8797758d3b0cfbba031e567 Mon Sep 17 00:00:00 2001 From: Arthur Del Esposte Date: Thu, 14 Aug 2014 16:46:37 -0300 Subject: [PATCH] Remove paginate from ArticleBlock blog's presentation --- app/helpers/blog_helper.rb | 4 ++-- app/views/content_viewer/blog_page.html.erb | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/helpers/blog_helper.rb b/app/helpers/blog_helper.rb index 702f496..69e2a2a 100644 --- a/app/helpers/blog_helper.rb +++ b/app/helpers/blog_helper.rb @@ -17,13 +17,13 @@ module BlogHelper _('Configure blog') end - def list_posts(articles, format = 'full') + def list_posts(articles, format = 'full', paginate = true) pagination = will_paginate(articles, { :param_name => 'npage', :previous_label => _('« Newer posts'), :next_label => _('Older posts »'), :params => {:action=>"view_page", :page=>articles.first.parent.path.split('/'), :controller=>"content_viewer"} - }) if articles.present? + }) if articles.present? && paginate content = [] artic_len = articles.length articles.each_with_index{ |art,i| diff --git a/app/views/content_viewer/blog_page.html.erb b/app/views/content_viewer/blog_page.html.erb index d48ec35..8645ec3 100644 --- a/app/views/content_viewer/blog_page.html.erb +++ b/app/views/content_viewer/blog_page.html.erb @@ -9,13 +9,15 @@
+ <% paginate = true %> <%= posts = @posts format = blog.visualization_format if inside_block posts = blog.posts.paginate(:page=>1, :per_page=>inside_block.posts_per_page) format = inside_block.visualization_format + paginate = false end - (blog.empty? ? content_tag('em', _('(no posts)')) : list_posts(posts, format)) + (blog.empty? ? content_tag('em', _('(no posts)')) : list_posts(posts, format, paginate)) %>
-- libgit2 0.21.2