diff --git a/app/controllers/public/content_viewer_controller.rb b/app/controllers/public/content_viewer_controller.rb index fe9443a..0260d8a 100644 --- a/app/controllers/public/content_viewer_controller.rb +++ b/app/controllers/public/content_viewer_controller.rb @@ -11,6 +11,7 @@ class ContentViewerController < ApplicationController path = get_path(params[:page], params[:format]) @version = params[:version].to_i + @npage = params[:npage] || '1' if path.blank? @page = profile.home_page diff --git a/app/helpers/blog_helper.rb b/app/helpers/blog_helper.rb index 5c87253..aa08107 100644 --- a/app/helpers/blog_helper.rb +++ b/app/helpers/blog_helper.rb @@ -2,6 +2,7 @@ module BlogHelper include ArticleHelper + def custom_options_for_article(article,tokenized_children) @article = article hidden_field_tag('article[published]', 1) + @@ -22,7 +23,9 @@ module BlogHelper :param_name => 'npage', :previous_label => _('« Newer posts'), :next_label => _('Older posts »'), - :params => {:action=>"view_page", :page=>articles.first.parent.path.split('/'), :controller=>"content_viewer"} + :params => {:action=>"view_page", + :page=>articles.first.parent.path.split('/'), + :controller=>"content_viewer"} }) if articles.present? && conf[:paginate] content = [] artic_len = articles.length @@ -44,7 +47,7 @@ module BlogHelper end def display_post(article, format = 'full') - no_comments = (format == 'full') ? false : true + no_comments = (format == 'full' || format == 'compact' ) ? false : true title = article_title(article, :no_comments => no_comments) method = "display_#{format.split('+')[0]}_format" html = send(method, FilePresenter.for(article)).html_safe @@ -55,8 +58,12 @@ module BlogHelper else '
' end - end.to_s + - title + html + end.to_s + title + html + end + + def display_compact_format(article) + render :file => 'content_viewer/_display_compact_format', + :locals => { :article => article, :format => "compact" } end def display_full_format(article) diff --git a/app/models/blog.rb b/app/models/blog.rb index edee58e..7a17124 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb @@ -76,9 +76,12 @@ class Blog < Folder end settings_items :visualization_format, :type => :string, :default => 'full' - validates_inclusion_of :visualization_format, :in => [ 'full', 'short', 'short+pic' ], :if => :visualization_format + validates_inclusion_of :visualization_format, + :in => [ 'full', 'short', 'short+pic', 'compact'], + :if => :visualization_format - settings_items :display_posts_in_current_language, :type => :boolean, :default => false + settings_items :display_posts_in_current_language, + :type => :boolean, :default => false alias :display_posts_in_current_language? :display_posts_in_current_language diff --git a/app/views/cms/_blog.html.erb b/app/views/cms/_blog.html.erb index 3a8c5be..5efe648 100644 --- a/app/views/cms/_blog.html.erb +++ b/app/views/cms/_blog.html.erb @@ -67,7 +67,8 @@ <%= labelled_form_field(_('How to display posts:'), f.select(:visualization_format, [ [ _('Full post'), 'full'], [ _('First paragraph'), 'short'], - [ _('First paragraph, with post picture'), 'short+pic'] + [ _('First paragraph, with post picture'), 'short+pic'], + [ _("Title, Image, Lead"), 'compact'] ])) %> <%= labelled_form_field(_('Posts per page:'), f.select(:posts_per_page, Blog.posts_per_page_options)) %> diff --git a/app/views/content_viewer/_display_compact_format.html.erb b/app/views/content_viewer/_display_compact_format.html.erb new file mode 100644 index 0000000..ad8d0e0 --- /dev/null +++ b/app/views/content_viewer/_display_compact_format.html.erb @@ -0,0 +1,21 @@ +<% if article.image %> + <% className = "article-compact-abstract-with-image" %> + <% if article.image.thumbnails_processed? %> + <% image_file = article.image.thumbnails[4].public_filename %> + <% else %> + <% image_file = "/images/icons-app/image-loading-thumb.png" %> + <% end %> +<% else %> + <% className = "article-compact-abstract" %> +<% end %> + +