Commit 6f535a53 authored by Antonio Terceiro's avatar Antonio Terceiro
Browse files

Merge branch 'preview_configuration' of https://gitlab.com/danielafeitosa/noosfero

parents 8f8895e7 840e77eb
......@@ -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
......
......@@ -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
......
......@@ -41,4 +41,8 @@ class TextArticle < Article
end
end
def display_preview?
parent && parent.kind_of?(Blog) && parent.display_preview
end
end
......@@ -7,7 +7,7 @@
<% end %>
</h1>
<%= render :partial => "publishing_info" %>
<% unless @page.abstract.blank? %>
<% if @page.display_preview? %>
<div class="preview">
<%= @page.lead %>
</div>
......
......@@ -2214,4 +2214,9 @@ class ArticleTest < ActiveSupport::TestCase
assert !a.display_media_panel?
end
should 'have display_preview' do
a = Article.new(:display_preview => false)
assert !a.display_preview?
end
end
......@@ -109,4 +109,12 @@ class TextArticleTest < ActiveSupport::TestCase
assert text.translatable?
end
should 'display preview when configured on parent that is a blog' do
person = fast_create(Person)
post = fast_create(TextArticle, :profile_id => person.id)
blog = Blog.new(:display_preview => true)
post.parent = blog
assert post.display_preview?
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment