Commit 17c8b3be7160c27bcda5b339529c42098f421a58

Authored by Hebert Santos
Committed by Tallys Martins
1 parent 05d537e3

Fixed bug on plugin views

Changed html forms to rails3 pattern.

Signed-off-by: Andre Bernardes <andrebsguedes@gmail.com>
Signed-off-by: Hebert Douglas <hebertdougl@gmail>
Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
app/views/cms/upload_files.html.erb
... ... @@ -20,7 +20,7 @@
20 20 <h5><%= _('Uploading files to %s') % content_tag('code', @target) %></h5>
21 21  
22 22 <% if @plugins.dispatch(:upload_files_extra_contents).size == 0 %>
23   - <% form_for('uploaded_file', :url => { :action => 'upload_files' }, :html => {:multipart => true}) do |f| %>
  23 + <%= form_for('uploaded_file', :url => { :action => 'upload_files' }, :html => {:multipart => true}) do |f| %>
24 24  
25 25 <%= render :partial => 'upload_file_form', :locals => { :size => '45'} %>
26 26  
... ...
plugins/work_assignment/lib/work_assignment_plugin.rb
... ... @@ -54,7 +54,17 @@ class WorkAssignmentPlugin &lt; Noosfero::Plugin
54 54  
55 55 def upload_files_extra_contents
56 56 proc do
57   - render :partial => 'work_assignment_form', :locals => { :size => '45'}
  57 + if params[:parent_id]
  58 + parent_id = params[:parent_id]
  59 + path = Article.find_by_id(parent_id).path.split("/")[0]
  60 + content = profile.articles.find_by_path(path)
  61 +
  62 + if content.type == "WorkAssignmentPlugin::WorkAssignment"
  63 + render :partial => 'work_assignment_form', :locals => { :size => '45'}
  64 + end
  65 + else
  66 + render :partial => 'upload_file_form', :locals => { :size => '45'}
  67 + end
58 68 end
59 69 end
60 70  
... ...