Commit cc70638a652146bc309836f8a6345511c5a980c3

Authored by MoisesMachado
1 parent 6d178f39

ActionItem121: added a cancel buton to the display_submit_tag


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1190 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/helpers/application_helper.rb
@@ -176,8 +176,11 @@ module ApplicationHelper @@ -176,8 +176,11 @@ module ApplicationHelper
176 end 176 end
177 alias_method :display_form_field, :labelled_form_field 177 alias_method :display_form_field, :labelled_form_field
178 178
179 - def display_submit_tag(label)  
180 - content_tag('p', submit_tag( label, :class => 'submit'), :class => 'submitline') 179 + # FIXME: do not use window.history on the cancel button, instead go to the page where the user come from
  180 + def display_submit_tag(label, options = {})
  181 + cancel_button = ''
  182 + cancel_button = "<input type='button' class='bt_cancel' value='" + _('Cancel') + "' onclick='window.history.back()'> " if options[:with_cancel]
  183 + content_tag('p', submit_tag( label, :class => 'submit') + cancel_button, :class => 'submitline')
181 end 184 end
182 185
183 186
app/views/profile_editor/organization_info.rhtml
@@ -5,5 +5,5 @@ @@ -5,5 +5,5 @@
5 <%= f.text_field(:legal_form) %> 5 <%= f.text_field(:legal_form) %>
6 <%= f.text_field(:economic_activity) %> 6 <%= f.text_field(:economic_activity) %>
7 <%= f.text_area(:management_information) %> 7 <%= f.text_area(:management_information) %>
8 - <%= display_submit_tag(_('Save')) %> 8 + <%= display_submit_tag(_('Save'), :with_cancel => true) %>
9 <% end %> 9 <% end %>