diff --git a/app/helpers/blog_helper.rb b/app/helpers/blog_helper.rb index a185502..e29cf80 100644 --- a/app/helpers/blog_helper.rb +++ b/app/helpers/blog_helper.rb @@ -6,7 +6,13 @@ module BlogHelper @article = article hidden_field_tag('article[published]', 1) + hidden_field_tag('article[accept_comments]', 0) + - visibility_options(article,tokenized_children) + visibility_options(article,tokenized_children) + + content_tag('h4', _('Visualization of posts')) + + content_tag( + 'div', + check_box(:article, :display_preview) + + content_tag('label', _('I want to display the preview of posts before the text'), :for => 'article_display_preview') + ) end def cms_label_for_new_children diff --git a/app/models/article.rb b/app/models/article.rb index 44bc601..94c3664 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -9,7 +9,7 @@ class Article < ActiveRecord::Base :highlighted, :notify_comments, :display_hits, :slug, :external_feed_builder, :display_versions, :external_link, :image_builder, :show_to_followers, - :author + :author, :display_preview acts_as_having_image @@ -643,6 +643,12 @@ class Article < ActiveRecord::Base false end + settings_items :display_preview, :type => :boolean, :default => false + + def display_preview? + false + end + def image? false end diff --git a/app/models/text_article.rb b/app/models/text_article.rb index 66dbe9f..9cf6870 100644 --- a/app/models/text_article.rb +++ b/app/models/text_article.rb @@ -41,4 +41,8 @@ class TextArticle < Article end end + def display_preview? + parent && parent.kind_of?(Blog) && parent.display_preview + end + end diff --git a/app/views/content_viewer/_article_title.html.erb b/app/views/content_viewer/_article_title.html.erb index 240b8b7..241ed90 100644 --- a/app/views/content_viewer/_article_title.html.erb +++ b/app/views/content_viewer/_article_title.html.erb @@ -7,7 +7,7 @@ <% end %> <%= render :partial => "publishing_info" %> - <% unless @page.abstract.blank? %> + <% if @page.display_preview? %>