Commit ff77482cb4796091aeb0dc9484b28da86f91bacd
1 parent
ee4938d9
Exists in
master
and in
28 other branches
Changed display_posts_in_current_language to false by default
Showing
4 changed files
with
18 additions
and
9 deletions
Show diff stats
app/models/blog.rb
... | ... | @@ -68,7 +68,7 @@ class Blog < Folder |
68 | 68 | settings_items :visualization_format, :type => :string, :default => 'full' |
69 | 69 | validates_inclusion_of :visualization_format, :in => [ 'full', 'short' ], :if => :visualization_format |
70 | 70 | |
71 | - settings_items :display_posts_in_current_language, :type => :boolean, :default => true | |
71 | + settings_items :display_posts_in_current_language, :type => :boolean, :default => false | |
72 | 72 | |
73 | 73 | alias :display_posts_in_current_language? :display_posts_in_current_language |
74 | 74 | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -1323,11 +1323,17 @@ class CmsControllerTest < ActionController::TestCase |
1323 | 1323 | assert_no_tag :select, :attributes => { :id => 'article_language'} |
1324 | 1324 | end |
1325 | 1325 | |
1326 | - should 'display display posts in current language input checked on edit blog' do | |
1327 | - get :new, :profile => profile.identifier, :type => 'Blog' | |
1326 | + should 'display display posts in current language input checked when editing blog' do | |
1327 | + profile.articles << Blog.new(:name => 'Blog for test', :profile => profile, :display_posts_in_current_language => true) | |
1328 | + get :edit, :profile => profile.identifier, :id => profile.blog.id | |
1328 | 1329 | assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[display_posts_in_current_language]', :checked => 'checked' } |
1329 | 1330 | end |
1330 | 1331 | |
1332 | + should 'display display posts in current language input not checked on new blog' do | |
1333 | + get :new, :profile => profile.identifier, :type => 'Blog' | |
1334 | + assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[display_posts_in_current_language]', :checked => 'checked' } | |
1335 | + end | |
1336 | + | |
1331 | 1337 | should 'update to false blog display posts in current language setting' do |
1332 | 1338 | profile.articles << Blog.new(:name => 'Blog for test', :profile => profile, :display_posts_in_current_language => true) |
1333 | 1339 | post :edit, :profile => profile.identifier, :id => profile.blog.id, :article => { :display_posts_in_current_language => false } | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -1135,7 +1135,8 @@ class ContentViewerControllerTest < ActionController::TestCase |
1135 | 1135 | should 'replace article for his translation at blog listing if blog option is enabled' do |
1136 | 1136 | FastGettext.stubs(:locale).returns('es') |
1137 | 1137 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') |
1138 | - blog.stubs(:display_posts_in_current_language).returns(true) | |
1138 | + blog.display_posts_in_current_language = true | |
1139 | + blog.save | |
1139 | 1140 | en_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en', :parent_id => blog.id) |
1140 | 1141 | es_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :parent_id => blog.id, :translation_of_id => en_article) |
1141 | 1142 | |
... | ... | @@ -1147,7 +1148,8 @@ class ContentViewerControllerTest < ActionController::TestCase |
1147 | 1148 | should 'not display article at blog listing if blog option is enabled and there is no translation for the language' do |
1148 | 1149 | FastGettext.stubs(:locale).returns('pt') |
1149 | 1150 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') |
1150 | - blog.stubs(:display_posts_in_current_language).returns(true) | |
1151 | + blog.display_posts_in_current_language = true | |
1152 | + blog.save | |
1151 | 1153 | en_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en', :parent_id => blog.id) |
1152 | 1154 | es_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :parent_id => blog.id, :translation_of_id => en_article) |
1153 | 1155 | pt_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'pt', :parent_id => blog.id, :translation_of_id => en_article) |
... | ... | @@ -1175,7 +1177,8 @@ class ContentViewerControllerTest < ActionController::TestCase |
1175 | 1177 | should 'display only native translations at blog listing if blog option is enabled' do |
1176 | 1178 | FastGettext.stubs(:locale).returns('es') |
1177 | 1179 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') |
1178 | - blog.stubs(:display_posts_in_current_language).returns(true) | |
1180 | + blog.display_posts_in_current_language = true | |
1181 | + blog.save! | |
1179 | 1182 | en_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en', :parent_id => blog.id) |
1180 | 1183 | es_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :parent_id => blog.id, :translation_of_id => en_article) |
1181 | 1184 | blog.posts = [en_article, es_article] | ... | ... |
test/unit/blog_test.rb
... | ... | @@ -179,10 +179,10 @@ class BlogTest < ActiveSupport::TestCase |
179 | 179 | assert Blog.new.has_posts? |
180 | 180 | end |
181 | 181 | |
182 | - should 'display posts in current language by default' do | |
182 | + should 'not display posts in current language by default' do | |
183 | 183 | blog = Blog.new |
184 | - assert blog.display_posts_in_current_language | |
185 | - assert blog.display_posts_in_current_language? | |
184 | + assert !blog.display_posts_in_current_language | |
185 | + assert !blog.display_posts_in_current_language? | |
186 | 186 | end |
187 | 187 | |
188 | 188 | should 'update display posts in current language setting' do | ... | ... |