Commit fa48ff328309f877bc41ddb430126678c7d09362

Authored by AntonioTerceiro
1 parent e6c532aa

ActionItem170: minor fix in submit button and one of the calls to it which was

breaking several tests


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1435 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/helpers/application_helper.rb
... ... @@ -278,7 +278,7 @@ module ApplicationHelper
278 278 end
279 279  
280 280 def submit_button(type, label, html_options = {})
281   - bt_cancel = html_options[:cancel] ? "<input type='button' class='button bt_cancel' value='" + _('Cancel') + "' onclick='document.location.href = \"#{url_for html_options.delete(:cancel)}\"'> " : ''
  281 + bt_cancel = html_options[:cancel] ? button(:cancel, _('Cancel'), html_options[:cancel]) : ''
282 282  
283 283 html_options[:class] = [html_options[:class], 'submit'].compact.join(' ')
284 284  
... ... @@ -289,7 +289,7 @@ module ApplicationHelper
289 289  
290 290 bt_submit = submit_tag(label, html_options.merge(:class => the_class))
291 291  
292   - bt_submit + bt_cancel
  292 + bt_submit
293 293 end
294 294  
295 295 def button_to_function(type, label, js_code, html_options = {})
... ...
app/views/cms/edit.rhtml
... ... @@ -16,6 +16,6 @@
16 16 %>
17 17  
18 18 <% button_bar do %>
19   - <%= submit_button('save', _('Save'), :cancel => [:action => (@article.parent ? 'view' : 'index')], :id => @article.parent) %>
  19 + <%= submit_button('save', _('Save'), :cancel => (@article.parent ? { :action => 'view', :id => @article.parent.id } : { :action => 'index' } )) %>
20 20 <% end %>
21 21 <% end %>
... ...