Commit c9517286e7bee94dd2230c6f08ffd3c7285f38dd
Committed by
Antonio Terceiro
1 parent
26a8cdfc
Added option to configure if preview in posts will be displayed
(cherry picked from commit 840e77eb53a5432ff99e8fe4966c61aeba9df14d)
Showing
6 changed files
with
32 additions
and
3 deletions
Show diff stats
app/helpers/blog_helper.rb
| ... | ... | @@ -6,7 +6,13 @@ module BlogHelper |
| 6 | 6 | @article = article |
| 7 | 7 | hidden_field_tag('article[published]', 1) + |
| 8 | 8 | hidden_field_tag('article[accept_comments]', 0) + |
| 9 | - visibility_options(article,tokenized_children) | |
| 9 | + visibility_options(article,tokenized_children) + | |
| 10 | + content_tag('h4', _('Visualization of posts')) + | |
| 11 | + content_tag( | |
| 12 | + 'div', | |
| 13 | + check_box(:article, :display_preview) + | |
| 14 | + content_tag('label', _('I want to display the preview of posts before the text'), :for => 'article_display_preview') | |
| 15 | + ) | |
| 10 | 16 | end |
| 11 | 17 | |
| 12 | 18 | def cms_label_for_new_children | ... | ... |
app/models/article.rb
| ... | ... | @@ -8,7 +8,8 @@ class Article < ActiveRecord::Base |
| 8 | 8 | :accept_comments, :feed, :published, :source, :source_name, |
| 9 | 9 | :highlighted, :notify_comments, :display_hits, :slug, |
| 10 | 10 | :external_feed_builder, :display_versions, :external_link, |
| 11 | - :image_builder, :show_to_followers | |
| 11 | + :image_builder, :show_to_followers, | |
| 12 | + :display_preview | |
| 12 | 13 | |
| 13 | 14 | acts_as_having_image |
| 14 | 15 | |
| ... | ... | @@ -634,6 +635,12 @@ class Article < ActiveRecord::Base |
| 634 | 635 | can_display_hits? && display_hits |
| 635 | 636 | end |
| 636 | 637 | |
| 638 | + settings_items :display_preview, :type => :boolean, :default => false | |
| 639 | + | |
| 640 | + def display_preview? | |
| 641 | + false | |
| 642 | + end | |
| 643 | + | |
| 637 | 644 | def image? |
| 638 | 645 | false |
| 639 | 646 | end | ... | ... |
app/models/text_article.rb
app/views/content_viewer/_article_title.html.erb
test/unit/article_test.rb
test/unit/text_article_test.rb
| ... | ... | @@ -120,4 +120,12 @@ class TextArticleTest < ActiveSupport::TestCase |
| 120 | 120 | assert text.translatable? |
| 121 | 121 | end |
| 122 | 122 | |
| 123 | + should 'display preview when configured on parent that is a blog' do | |
| 124 | + person = fast_create(Person) | |
| 125 | + post = fast_create(TextArticle, :profile_id => person.id) | |
| 126 | + blog = Blog.new(:display_preview => true) | |
| 127 | + post.parent = blog | |
| 128 | + assert post.display_preview? | |
| 129 | + end | |
| 130 | + | |
| 123 | 131 | end | ... | ... |