Commit 2d3b14bf016200f669a2669dcbd1e5bdf3ae5b50
1 parent
9f2ce2c2
Exists in
master
and in
11 other branches
Fix proposal edition layout
Showing
3 changed files
with
17 additions
and
3 deletions
Show diff stats
lib/proposals_discussion_plugin.rb
@@ -13,7 +13,7 @@ class ProposalsDiscussionPlugin < Noosfero::Plugin | @@ -13,7 +13,7 @@ class ProposalsDiscussionPlugin < Noosfero::Plugin | ||
13 | end | 13 | end |
14 | 14 | ||
15 | def content_types | 15 | def content_types |
16 | - if context.respond_to?(:params) && context.params | 16 | + if context.respond_to?(:params) && context.params.kind_of?(Hash) && context.params[:controller] == 'cms' && context.params[:action] == 'new' |
17 | types = [] | 17 | types = [] |
18 | parent_id = context.params[:parent_id] | 18 | parent_id = context.params[:parent_id] |
19 | parent = parent_id ? context.profile.articles.find(parent_id) : nil | 19 | parent = parent_id ? context.profile.articles.find(parent_id) : nil |
public/style.css
@@ -132,8 +132,11 @@ | @@ -132,8 +132,11 @@ | ||
132 | position: relative; | 132 | position: relative; |
133 | } | 133 | } |
134 | 134 | ||
135 | +form .proposals-discussion-plugin .title { | ||
136 | + width: 50%; | ||
137 | +} | ||
135 | form .proposals-discussion-plugin textarea { | 138 | form .proposals-discussion-plugin textarea { |
136 | - width: 98%; | 139 | + width: 100%; |
137 | } | 140 | } |
138 | 141 | ||
139 | form .proposals-discussion-plugin .abstract textarea { | 142 | form .proposals-discussion-plugin .abstract textarea { |
test/unit/proposals_discussion_plugin_test.rb
@@ -5,7 +5,7 @@ class ProposalsDiscussionPluginTest < ActiveSupport::TestCase | @@ -5,7 +5,7 @@ class ProposalsDiscussionPluginTest < ActiveSupport::TestCase | ||
5 | def setup | 5 | def setup |
6 | @plugin = ProposalsDiscussionPlugin.new | 6 | @plugin = ProposalsDiscussionPlugin.new |
7 | @profile = fast_create(Community) | 7 | @profile = fast_create(Community) |
8 | - @params = {} | 8 | + @params = {:controller => 'cms', :action => 'new'} |
9 | @plugin.stubs(:context).returns(self) | 9 | @plugin.stubs(:context).returns(self) |
10 | end | 10 | end |
11 | 11 | ||
@@ -43,6 +43,17 @@ class ProposalsDiscussionPluginTest < ActiveSupport::TestCase | @@ -43,6 +43,17 @@ class ProposalsDiscussionPluginTest < ActiveSupport::TestCase | ||
43 | assert_not_includes plugin.content_types, ProposalsDiscussionPlugin::Proposal | 43 | assert_not_includes plugin.content_types, ProposalsDiscussionPlugin::Proposal |
44 | end | 44 | end |
45 | 45 | ||
46 | + should 'return all content types if the context controller is not cms' do | ||
47 | + params[:controller] = 'content_viewer' | ||
48 | + assert_equal [ProposalsDiscussionPlugin::Discussion, ProposalsDiscussionPlugin::Topic, ProposalsDiscussionPlugin::Proposal], plugin.content_types | ||
49 | + end | ||
50 | + | ||
51 | + should 'return all content types if the context controller is cms and action is not new' do | ||
52 | + params[:controller] = 'cms' | ||
53 | + params[:action] = 'edit' | ||
54 | + assert_equal [ProposalsDiscussionPlugin::Discussion, ProposalsDiscussionPlugin::Topic, ProposalsDiscussionPlugin::Proposal], plugin.content_types | ||
55 | + end | ||
56 | + | ||
46 | should 'remove new button from content page for a discussion' do | 57 | should 'remove new button from content page for a discussion' do |
47 | page = fast_create(ProposalsDiscussionPlugin::Discussion, :profile_id => @profile.id) | 58 | page = fast_create(ProposalsDiscussionPlugin::Discussion, :profile_id => @profile.id) |
48 | assert plugin.content_remove_new(page) | 59 | assert plugin.content_remove_new(page) |