Commit 5e8e25e98cf06dc6413596aebb6869559de93b1a

Authored by Rodrigo Souto
2 parents 5f1ce128 66eb5163

Merge branch 'new_topic_comments_default_permission' into 'master'

Explicit hidden filed on topic creation(forum)

Users reported the confusing behaviour of "new topic" feature. This MR makes explicit the option that allows  users to "leave comments" at the time they create a new topic instead of only the edition.

See [travis-ci](https://travis-ci.org/tallysmartins/noosfero/jobs/84188394) for test status for this branch.

See merge request !699
app/helpers/article_helper.rb
... ... @@ -23,13 +23,11 @@ module ArticleHelper
23 23 ) :
24 24 '') +
25 25  
26   - (article.parent && article.parent.forum? && controller.action_name == 'new' ?
27   - hidden_field_tag('article[accept_comments]', 1) :
28 26 content_tag(
29 27 'div',
30 28 check_box(:article, :accept_comments) +
31 29 content_tag('label', (article.parent && article.parent.forum? ? _('This topic is opened for replies') : _('I want to receive comments about this article')), :for => 'article_accept_comments')
32   - )) +
  30 + ) +
33 31  
34 32 content_tag(
35 33 'div',
... ...
test/functional/cms_controller_test.rb
... ... @@ -1601,11 +1601,11 @@ class CmsControllerTest < ActionController::TestCase
1601 1601 assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[display_posts_in_current_language]', :checked => 'checked' }
1602 1602 end
1603 1603  
1604   - should 'not display accept comments option when creating forum post' do
  1604 + should 'display accept comments option when creating forum post' do
1605 1605 profile.articles << f = Forum.new(:name => 'Forum for test')
1606 1606 get :new, :profile => profile.identifier, :type => 'TinyMceArticle', :parent_id => f.id
1607   - assert :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'hidden'}
1608   - assert_no_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'}
  1607 + assert_no_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'hidden'}
  1608 + assert_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'}
1609 1609 end
1610 1610  
1611 1611 should 'display accept comments option when creating an article that is not a forum post' do
... ...