Commit 3a32ff13a05df2d443410642172c2a4df1585ca1
1 parent
89db7369
Exists in
master
and in
9 other branches
Add story content type
Showing
3 changed files
with
20 additions
and
4 deletions
Show diff stats
lib/proposals_discussion_plugin.rb
@@ -19,12 +19,16 @@ class ProposalsDiscussionPlugin < Noosfero::Plugin | @@ -19,12 +19,16 @@ class ProposalsDiscussionPlugin < Noosfero::Plugin | ||
19 | parent = parent_id ? context.profile.articles.find(parent_id) : nil | 19 | parent = parent_id ? context.profile.articles.find(parent_id) : nil |
20 | types << ProposalsDiscussionPlugin::Discussion | 20 | types << ProposalsDiscussionPlugin::Discussion |
21 | types << ProposalsDiscussionPlugin::Topic if parent.kind_of?(ProposalsDiscussionPlugin::Discussion) | 21 | types << ProposalsDiscussionPlugin::Topic if parent.kind_of?(ProposalsDiscussionPlugin::Discussion) |
22 | - types << ProposalsDiscussionPlugin::Proposal if parent.kind_of?(ProposalsDiscussionPlugin::Topic) || ( parent.kind_of?(ProposalsDiscussionPlugin::Discussion) && !parent.allow_topics) | 22 | + if parent.kind_of?(ProposalsDiscussionPlugin::Topic) || ( parent.kind_of?(ProposalsDiscussionPlugin::Discussion) && !parent.allow_topics) |
23 | + types << ProposalsDiscussionPlugin::Proposal | ||
24 | + types << ProposalsDiscussionPlugin::Story | ||
25 | + end | ||
23 | types | 26 | types |
24 | else | 27 | else |
25 | [ProposalsDiscussionPlugin::Discussion, | 28 | [ProposalsDiscussionPlugin::Discussion, |
26 | ProposalsDiscussionPlugin::Topic, | 29 | ProposalsDiscussionPlugin::Topic, |
27 | - ProposalsDiscussionPlugin::Proposal] | 30 | + ProposalsDiscussionPlugin::Proposal, |
31 | + ProposalsDiscussionPlugin::Story] | ||
28 | end | 32 | end |
29 | end | 33 | end |
30 | 34 |
test/unit/proposals_discussion_plugin_test.rb
@@ -45,13 +45,13 @@ class ProposalsDiscussionPluginTest < ActiveSupport::TestCase | @@ -45,13 +45,13 @@ class ProposalsDiscussionPluginTest < ActiveSupport::TestCase | ||
45 | 45 | ||
46 | should 'return all content types if the context controller is not cms' do | 46 | should 'return all content types if the context controller is not cms' do |
47 | params[:controller] = 'content_viewer' | 47 | params[:controller] = 'content_viewer' |
48 | - assert_equal [ProposalsDiscussionPlugin::Discussion, ProposalsDiscussionPlugin::Topic, ProposalsDiscussionPlugin::Proposal], plugin.content_types | 48 | + assert_equal [ProposalsDiscussionPlugin::Discussion, ProposalsDiscussionPlugin::Topic, ProposalsDiscussionPlugin::Proposal, ProposalsDiscussionPlugin::Story], plugin.content_types |
49 | end | 49 | end |
50 | 50 | ||
51 | should 'return all content types if the context controller is cms and action is not new' do | 51 | should 'return all content types if the context controller is cms and action is not new' do |
52 | params[:controller] = 'cms' | 52 | params[:controller] = 'cms' |
53 | params[:action] = 'edit' | 53 | params[:action] = 'edit' |
54 | - assert_equal [ProposalsDiscussionPlugin::Discussion, ProposalsDiscussionPlugin::Topic, ProposalsDiscussionPlugin::Proposal], plugin.content_types | 54 | + assert_equal [ProposalsDiscussionPlugin::Discussion, ProposalsDiscussionPlugin::Topic, ProposalsDiscussionPlugin::Proposal, ProposalsDiscussionPlugin::Story], plugin.content_types |
55 | end | 55 | end |
56 | 56 | ||
57 | should 'remove new button from content page for a discussion' do | 57 | should 'remove new button from content page for a discussion' do |