Commit 94c1d5eca3ed2e6e76d544e0dbc2011902a1f04a

Authored by Antonio Terceiro
2 parents 35e061b3 a69db7b5

Merge branch 'AI3262-custom_form_plugin_bug' into 'master'

Ai3262 custom form plugin bug

Fixing custom_forms plugin's rails 3 bug -> http://noosfero.org/Development/ActionItem3262

See merge request !293
plugins/custom_forms/lib/custom_forms_plugin/alternative.rb
... ... @@ -5,6 +5,6 @@ class CustomFormsPlugin::Alternative < ActiveRecord::Base
5 5  
6 6 belongs_to :field, :class_name => 'CustomFormsPlugin::Field'
7 7  
8   - attr_accessible :label, :field, :position
  8 + attr_accessible :label, :field, :position, :selected_by_default
9 9 end
10 10  
... ...
plugins/custom_forms/views/custom_forms_plugin_myprofile/_field.html.erb
... ... @@ -12,7 +12,7 @@
12 12 <%= f.hidden_field(:position) %>
13 13  
14 14 <%= f.hidden_field :_destroy, :class => 'destroy-field' %>
15   - <%= button_to_function :delete, _('Remove field'), "customFormsPlugin.removeFieldBox(this, #{j _('Are you sure you want to remove this field?').to_json})" %>
  15 + <%= button_to_function :delete, _('Remove field'), "customFormsPlugin.removeFieldBox(this, #{CGI::escapeHTML(_('Are you sure you want to remove this field?').to_json)})" %>
16 16 <%= yield %>
17 17 </div>
18 18 </fieldset>
... ...
plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb
... ... @@ -31,8 +31,8 @@
31 31 </ul>
32 32  
33 33 <div class="addition-buttons">
34   - <%= button(:add, _('Add a new text field'), '#', :onclick => "customFormsPlugin.addFields(this, 'fields', #{j html_for_field(f, :fields, CustomFormsPlugin::TextField).to_json}); return false")%>
35   - <%= button(:add, _('Add a new select field'), '#', :onclick => "customFormsPlugin.addFields(this, 'fields', #{j html_for_field(f, :fields, CustomFormsPlugin::SelectField).to_json}); return false")%>
  34 + <%= button(:add, _('Add a new text field'), '#', :onclick => "customFormsPlugin.addFields(this, 'fields', #{CGI::escapeHTML(html_for_field(f, :fields, CustomFormsPlugin::TextField).to_json)}); return false")%>
  35 + <%= button(:add, _('Add a new select field'), '#', :onclick => "customFormsPlugin.addFields(this, 'fields', #{CGI::escapeHTML(html_for_field(f, :fields, CustomFormsPlugin::SelectField).to_json)}); return false")%>
36 36 </div>
37 37  
38 38 <% button_bar do %>
... ...
plugins/custom_forms/views/custom_forms_plugin_myprofile/custom_forms_plugin/_alternative.html.erb
... ... @@ -7,6 +7,6 @@
7 7  
8 8 <td>
9 9 <%= f.hidden_field :_destroy, :class => 'destroy-field' %>
10   - <%= button_to_function_without_text :remove, _('Remove alternative'), "customFormsPlugin.removeAlternative(this, #{j _('Are you sure you want to remove this alternative?').to_json})", :class => 'remove-field', :title => _('Remove alternative') %>
  10 + <%= button_to_function_without_text :remove, _('Remove alternative'), "customFormsPlugin.removeAlternative(this, #{CGI::escapeHTML(_('Are you sure you want to remove this alternative?').to_json)})", :class => 'remove-field', :title => _('Remove alternative') %>
11 11 </td>
12 12 </tr>
... ...
plugins/custom_forms/views/custom_forms_plugin_myprofile/custom_forms_plugin/_select_field.html.erb
... ... @@ -22,7 +22,7 @@
22 22 <tfoot>
23 23 <tr class="addition-buttons">
24 24 <td colspan="3">
25   - <%= button(:add, _('Add a new alternative'), '#', :onclick => "customFormsPlugin.addFields(this, 'alternatives', #{j html_for_field(f, :alternatives, CustomFormsPlugin::Alternative).to_json}); return false") %>
  25 + <%= button(:add, _('Add a new alternative'), '#', :onclick => "customFormsPlugin.addFields(this, 'alternatives', #{CGI::escapeHTML(html_for_field(f, :alternatives, CustomFormsPlugin::Alternative).to_json)}); return false") %>
26 26 </td>
27 27 </tr>
28 28 </tfoot>
... ...
plugins/custom_forms/views/custom_forms_plugin_myprofile/show_submission.html.erb
1 1 <h1><%= @form.name %></h1>
2 2 <p><%= @form.description %></p>
3 3  
4   -<% fields_for :submission, @submission do |f| %>
  4 +<%= fields_for :submission, @submission do |f| %>
5 5 <%= render :partial => 'shared/form_submission', :locals => {:f => f} %>
6 6 <% end %>
7 7  
... ...