Commit 2d3b14bf016200f669a2669dcbd1e5bdf3ae5b50

Authored by Victor Costa
1 parent 9f2ce2c2

Fix proposal edition layout

lib/proposals_discussion_plugin.rb
... ... @@ -13,7 +13,7 @@ class ProposalsDiscussionPlugin < Noosfero::Plugin
13 13 end
14 14  
15 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 17 types = []
18 18 parent_id = context.params[:parent_id]
19 19 parent = parent_id ? context.profile.articles.find(parent_id) : nil
... ...
public/style.css
... ... @@ -132,8 +132,11 @@
132 132 position: relative;
133 133 }
134 134  
  135 +form .proposals-discussion-plugin .title {
  136 + width: 50%;
  137 +}
135 138 form .proposals-discussion-plugin textarea {
136   - width: 98%;
  139 + width: 100%;
137 140 }
138 141  
139 142 form .proposals-discussion-plugin .abstract textarea {
... ...
test/unit/proposals_discussion_plugin_test.rb
... ... @@ -5,7 +5,7 @@ class ProposalsDiscussionPluginTest < ActiveSupport::TestCase
5 5 def setup
6 6 @plugin = ProposalsDiscussionPlugin.new
7 7 @profile = fast_create(Community)
8   - @params = {}
  8 + @params = {:controller => 'cms', :action => 'new'}
9 9 @plugin.stubs(:context).returns(self)
10 10 end
11 11  
... ... @@ -43,6 +43,17 @@ class ProposalsDiscussionPluginTest < ActiveSupport::TestCase
43 43 assert_not_includes plugin.content_types, ProposalsDiscussionPlugin::Proposal
44 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 57 should 'remove new button from content page for a discussion' do
47 58 page = fast_create(ProposalsDiscussionPlugin::Discussion, :profile_id => @profile.id)
48 59 assert plugin.content_remove_new(page)
... ...