diff --git a/app/design_blocks/list_block/views/edit.rhtml b/app/design_blocks/list_block/views/edit.rhtml index f113014..eb73e80 100644 --- a/app/design_blocks/list_block/views/edit.rhtml +++ b/app/design_blocks/list_block/views/edit.rhtml @@ -16,5 +16,7 @@ <%= text_field 'design_block', 'limit_number'%>

- <%= submit_tag _('Save') %> + <% button_bar do %> + <%= submit_button('save', _('Save')) %> + <% end %> <% end %> diff --git a/app/design_blocks/profile_info_block/views/edit.rhtml b/app/design_blocks/profile_info_block/views/edit.rhtml index d7e5480..4f69f64 100644 --- a/app/design_blocks/profile_info_block/views/edit.rhtml +++ b/app/design_blocks/profile_info_block/views/edit.rhtml @@ -6,5 +6,7 @@ <%= text_field 'design_block', 'title'%>

- <%= submit_tag _('Save') %> + <% button_bar do %> + <%= submit_button('save', _('Save')) %> + <% end %> <% end %> diff --git a/app/design_blocks/view_article/views/edit.rhtml b/app/design_blocks/view_article/views/edit.rhtml index 99cf37b..9610d6b 100644 --- a/app/design_blocks/view_article/views/edit.rhtml +++ b/app/design_blocks/view_article/views/edit.rhtml @@ -11,5 +11,7 @@ <%= select 'design_block', 'article_id', @articles.map{|a|[a.full_name, a.id]} %>

- <%= submit_tag _('Save') %> + <% button_bar do %> + <%= submit_button('save', _('Save')) %> + <% end %> <% end %> diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 464a430..6cd3d7e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -179,15 +179,8 @@ module ApplicationHelper def labelled_form_field(label, field_html, field_id = nil) NoosferoFormBuilder::output_field(label, field_html, field_id) end - alias_method :display_form_field, :labelled_form_field - - # FIXME: do not use window.history on the cancel button, instead go to the page where the user come from - def display_submit_tag(label, options = {}) - cancel_button = '' - cancel_button = " " if options[:with_cancel] - content_tag('p', submit_tag( label, :class => 'submit') + cancel_button, :class => 'submitline') - end + alias_method :display_form_field, :labelled_form_field def labelled_form_for(name, object = nil, options = {}, &proc) object ||= instance_variable_get("@#{name}") @@ -278,7 +271,13 @@ module ApplicationHelper end def submit_button(type, label, html_options = {}) - design_display_button_submit(type, label, { :class => 'with_text' }.merge(html_options)) + bt_cancel = html_options[:cancel] ? " " : '' + + html_options[:class] = [html_options[:class], 'submit'].compact.join(' ') + + bt_submit = design_display_button_submit(type, label, { :class => 'with_text' }.merge(html_options)) + content_tag('p', bt_submit + bt_cancel, :class => 'submitline') + end def button_to_function(type, label, js_code, html_options = {}) diff --git a/app/views/account/forgot_password.rhtml b/app/views/account/forgot_password.rhtml index c50d356..d17abe2 100644 --- a/app/views/account/forgot_password.rhtml +++ b/app/views/account/forgot_password.rhtml @@ -8,7 +8,9 @@ <%= labelled_form_field(_('Username'), (f.text_field :login)) %> <%= labelled_form_field(_('E-mail'), (f.text_field :email)) %>
- <%= submit_tag _('Send change password procedure by e-mail') %> + <% button_bar do %> + <%= submit_button('send', _('Send change password procedure by e-mail')) %> + <% end %>
<% end %> diff --git a/app/views/account/login.rhtml b/app/views/account/login.rhtml index fa11256..2c71830 100644 --- a/app/views/account/login.rhtml +++ b/app/views/account/login.rhtml @@ -6,7 +6,9 @@ <%= display_form_field(_('Password'), password_field_tag(:password) ) %> -<%= display_submit_tag 'Log in' %> +<% button_bar do %> + <%= submit_button( 'login', _('Log in') )%> +<% end %> <% end %> diff --git a/app/views/account/new_password.rhtml b/app/views/account/new_password.rhtml index 4bb17d9..de70896 100644 --- a/app/views/account/new_password.rhtml +++ b/app/views/account/new_password.rhtml @@ -10,6 +10,8 @@ <%= labelled_form_field(_('Enter new password'), (f.password_field :password)) %> <%= labelled_form_field(_('Confirm the new password'), (f.password_field :password_confirmation)) %> - <%= submit_tag _('Change password') %> + <% button_bar do %> + <%= submit_button('change_password', _('Change password')) %> + <% end %> <% end %> diff --git a/app/views/account/signup.rhtml b/app/views/account/signup.rhtml index a455883..22dc57b 100644 --- a/app/views/account/signup.rhtml +++ b/app/views/account/signup.rhtml @@ -18,5 +18,7 @@

<% end %> -<%= display_submit_tag _('Sign up') %> +<% button_bar do %> + <%= submit_button('save', _('Sign up'), :cancel => {:action => 'index'}) %> +<% end %> <% end -%> diff --git a/app/views/categories/_form.rhtml b/app/views/categories/_form.rhtml index 007d240..fd0e68e 100644 --- a/app/views/categories/_form.rhtml +++ b/app/views/categories/_form.rhtml @@ -13,6 +13,7 @@ <%= select_color_for_category %> <%= f.text_field 'name' %> - <%= display_submit_tag _('Save') %> - <%= link_to _('Cancel'), :action => 'index' %> + <% button_bar do %> + <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %> + <% end%> <% end %> diff --git a/app/views/cms/edit.rhtml b/app/views/cms/edit.rhtml index 3c19a09..12a525a 100644 --- a/app/views/cms/edit.rhtml +++ b/app/views/cms/edit.rhtml @@ -13,6 +13,7 @@ <%# TODO display the tooltip (title below) in a directly visible way %> <%= f.text_field('tag_list', :size => 64, :title => _('Separate tags with commas')) %> - <%= design_display_button_submit('save', _('Save')) %> - <%= design_display_button('cancel', _('Cancel'), :action => (@article.parent ? 'view' : 'index'), :id => @article.parent) %> + <% button_bar do %> + <%= submit_button('save', _('Save'), :cancel => [:action => (@article.parent ? 'view' : 'index')], :id => @article.parent) %> + <% end %> <% end %> diff --git a/app/views/consumed_products/new.rhtml b/app/views/consumed_products/new.rhtml index b42c207..d251b9c 100644 --- a/app/views/consumed_products/new.rhtml +++ b/app/views/consumed_products/new.rhtml @@ -5,6 +5,7 @@ <% form_for :consumption, @consumption do |f| %>

<%= _('Product:') %> <%= f.select "product_category_id", ProductCategory.find(:all).map{|pc| [pc.name, pc.id]} %>

<%= _('Aditional specifications:') %>
<%= f.text_area "aditional_specifications" %>

- <%= submit_tag _('Add product') %> - <%= link_to _('Cancel'), :action => 'index' %> + <% button_bar do %> + <%= submit_button('add', _('Add product'), :cancel => {:action => 'index'}) %> + <% end %> <% end %> diff --git a/app/views/content_viewer/_comment_form.rhtml b/app/views/content_viewer/_comment_form.rhtml index 6e6e058..fe363c2 100644 --- a/app/views/content_viewer/_comment_form.rhtml +++ b/app/views/content_viewer/_comment_form.rhtml @@ -15,5 +15,7 @@ <%= labelled_form_field(_('Title'), text_field(:comment, :title)) %> <%= labelled_form_field(_('Enter your comment'), text_area(:comment, :body)) %> - <%= submit_tag _('Post comment') %> + <% button_bar do %> + <%= submit_button('post', _('Post comment')) %> + <% end %> <% end %> diff --git a/app/views/enterprise_editor/edit.rhtml b/app/views/enterprise_editor/edit.rhtml index b238d4a..62f43c0 100644 --- a/app/views/enterprise_editor/edit.rhtml +++ b/app/views/enterprise_editor/edit.rhtml @@ -4,6 +4,7 @@ <% form_tag :action => 'update', :id => @enterprise do %> <%= render :partial => 'form' %> -

<%= submit_tag _('Update') %> -<%= link_to _('Cancel'), :action => 'index' %>

+ <% button_bar do %> + <%= submit_button('save', _('Update'), :cancel => {:action => 'index'}) %> + <% end %> <% end %> diff --git a/app/views/enterprise_registration/basic_information.rhtml b/app/views/enterprise_registration/basic_information.rhtml index 12f94c1..e0eaee4 100644 --- a/app/views/enterprise_registration/basic_information.rhtml +++ b/app/views/enterprise_registration/basic_information.rhtml @@ -29,8 +29,7 @@ <%= f.select('region_id', @regions) %> <% button_bar do %> - <%= submit_button('next', _('Next')) %> - <%= button 'cancel', _('Cancel'), :action => 'index' %> + <%= submit_button('next', _('Next'), :cancel => {:action => 'index'}) %> <% end %> <% end %> diff --git a/app/views/enterprise_validation/details.rhtml b/app/views/enterprise_validation/details.rhtml index 1fc9018..7fe9d27 100644 --- a/app/views/enterprise_validation/details.rhtml +++ b/app/views/enterprise_validation/details.rhtml @@ -15,7 +15,9 @@

<%= _('If this enterprise passes the criteria to be considered an solidarity enconomy enterprise, you can approve it by click the button below.') %>

<% form_tag :action => 'approve', :id => @pending.code do %> -<%= submit_tag _('Approve') %> + <% button_bar do %> + <%= submit_button('approve', _('Approve')) %> + <% end %> <% end %>

<%= _('Reject') %>

@@ -25,6 +27,8 @@ <% form_tag :action => 'reject', :id => @pending.code do %> <%= labelled_form_field(_('Please provide an explanation for the rejection. This explanation will be sent to the requestor (required).'), text_area_tag('reject_explanation'))%>
- <%= submit_tag _('Reject') %> + <% button_bar do %> + <%= submit_button('reject', _('Reject')) %> + <% end %>
<% end %> diff --git a/app/views/environment_role_manager/affiliate.rhtml b/app/views/environment_role_manager/affiliate.rhtml index 4f23242..8d0d83d 100644 --- a/app/views/environment_role_manager/affiliate.rhtml +++ b/app/views/environment_role_manager/affiliate.rhtml @@ -3,7 +3,7 @@ <% form_tag( {:action => 'give_role'}, {:method => :post}) do %> <%= select_tag 'role', options_for_select(@roles.map{|r|[r.name,r.id]}) %> <%= hidden_field_tag 'person', current_user.person.id %> - <%= submit_tag _('Affiliate') %> + <% button_bar do %> + <%= submit_button('affiliate', _('Affiliate', :cancel => {:action => 'index'}) %> + <% end %> <% end %> - -<%= link_to _('Back'), :action => 'index' %> diff --git a/app/views/environment_role_manager/change_role.rhtml b/app/views/environment_role_manager/change_role.rhtml index 4056de7..f147166 100644 --- a/app/views/environment_role_manager/change_role.rhtml +++ b/app/views/environment_role_manager/change_role.rhtml @@ -8,6 +8,7 @@ <% end %> <%= hidden_field_tag 'person', @admin.id %> - <%= display_submit_tag _('Save changes') %> - <%= link_to _('Cancel'), :action => 'index' %> + <% button_bar do %> + <%= submit_button('save', _('Save changes'), :cancel => {:action => 'index'}) %> + <% end %> <% end %> diff --git a/app/views/environment_role_manager/make_admin.rhtml b/app/views/environment_role_manager/make_admin.rhtml index 14c1de7..43547ca 100644 --- a/app/views/environment_role_manager/make_admin.rhtml +++ b/app/views/environment_role_manager/make_admin.rhtml @@ -9,5 +9,7 @@ <% @roles.each do |r| %> <%= labelled_form_field(r.name, (check_box_tag "roles[]", r.id)) %> <% end %> -<%= display_submit_tag _('Make') %> + <% button_bar do %> + <%= submit_button( 'save', _('Make'), :cancel => {:action => 'index'} ) %> + <% end %> <% end %> diff --git a/app/views/features/_features_table.rhtml b/app/views/features/_features_table.rhtml index cdda609..91cc937 100644 --- a/app/views/features/_features_table.rhtml +++ b/app/views/features/_features_table.rhtml @@ -12,7 +12,9 @@ <%= labelled_form_field(_('Organization Approval Method'), select_organization_approval_method('environment', 'organization_approval_method')) %>
- <%= submit_tag _('Save changes') %> + <% button_bar do %> + <%= submit_button('save', _('Save changes')) %> + <% end %>
<% end %> diff --git a/app/views/manage_products/_form.rhtml b/app/views/manage_products/_form.rhtml index 3dbadb3..8957bff 100644 --- a/app/views/manage_products/_form.rhtml +++ b/app/views/manage_products/_form.rhtml @@ -6,6 +6,7 @@ <%= display_form_field( _('Description:'), f.text_area(:description) ) %> <%= display_form_field( _('Image:'), file_field_tag( "product[image_builder][uploaded_data]" ) ) %> <%= display_form_field( _('category:'), f.select( :product_category_id,ProductCategory.find(:all).map{|pc|[pc.name,pc.id]}, {:include_blank => true} )) %> - <%= display_submit_tag(mode == 'new' ? _('Create product') : _('Save changes')) %> - <%= link_to _('Cancel'), :action => 'index' %> + <% button_bar do %> + <%= submit_button('save', (mode == 'new' ? _('Create product') : _('Save changes')), :cancel => {:action => 'index'} ) %> + <% end %> <% end %> diff --git a/app/views/profile_editor/change_image.rhtml b/app/views/profile_editor/change_image.rhtml index 0c797bd..e64c8bc 100644 --- a/app/views/profile_editor/change_image.rhtml +++ b/app/views/profile_editor/change_image.rhtml @@ -2,6 +2,7 @@ :html => { :multipart => true }, :url => { :action => 'change_image'} do |f| %> <%= display_form_field(_('Image'), f.file_field( :uploaded_data, { :onchange => 'updateImg(this.value)' } ) ) %> - <%= display_submit_tag(_('Upload')) %> - <%= link_to _('Cancel'), :action => 'index' %> + <% button_bar do %> + <%= submit_button('save', _('Upload'), :cancel => {:action => 'index'}) %> + <% end %> <% end %> diff --git a/app/views/profile_editor/organization_info.rhtml b/app/views/profile_editor/organization_info.rhtml index a5d0efc..1b019dc 100644 --- a/app/views/profile_editor/organization_info.rhtml +++ b/app/views/profile_editor/organization_info.rhtml @@ -5,5 +5,7 @@ <%= f.text_field(:legal_form) %> <%= f.text_field(:economic_activity) %> <%= f.text_area(:management_information) %> - <%= display_submit_tag(_('Save'), :with_cancel => true) %> + <% button_bar do %> + <%= submit_button('save' , _('Save'), :cancel => {:action => 'index'}) %> + <% end %> <% end %> diff --git a/app/views/profile_editor/person_info.rhtml b/app/views/profile_editor/person_info.rhtml index e193565..4bba4d4 100644 --- a/app/views/profile_editor/person_info.rhtml +++ b/app/views/profile_editor/person_info.rhtml @@ -9,6 +9,8 @@ <%= f.text_field(:city) %> <%= f.text_field(:state) %> <%= f.text_field(:country) %> - <%= display_submit_tag _('Save') %> + <% button_bar do %> + <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %> + <% end %> <% end %> diff --git a/app/views/profile_members/affiliate.rhtml b/app/views/profile_members/affiliate.rhtml index 4f23242..d6aa01a 100644 --- a/app/views/profile_members/affiliate.rhtml +++ b/app/views/profile_members/affiliate.rhtml @@ -3,7 +3,7 @@ <% form_tag( {:action => 'give_role'}, {:method => :post}) do %> <%= select_tag 'role', options_for_select(@roles.map{|r|[r.name,r.id]}) %> <%= hidden_field_tag 'person', current_user.person.id %> - <%= submit_tag _('Affiliate') %> + <% button_bar do %> + <%= submit_button('affiliate', _('Affiliate'), :cancel => {:action => 'index'}) %> + <% end %> <% end %> - -<%= link_to _('Back'), :action => 'index' %> diff --git a/app/views/profile_members/change_role.rhtml b/app/views/profile_members/change_role.rhtml index 07b65a6..7f14e9c 100644 --- a/app/views/profile_members/change_role.rhtml +++ b/app/views/profile_members/change_role.rhtml @@ -9,6 +9,7 @@ <% end %> <%= hidden_field_tag 'person', @member.id %> - <%= display_submit_tag _('Save changes') %> - <%= link_to _('Cancel'), :action => 'index' %> + <% button_bar do %> + <%= submit_button('save', _('Save changes'), :cancel => {:action => 'index'}) %> + <% end %> <% end %> diff --git a/app/views/region_validators/_search.rhtml b/app/views/region_validators/_search.rhtml index 3ce1ec7..649df23 100644 --- a/app/views/region_validators/_search.rhtml +++ b/app/views/region_validators/_search.rhtml @@ -5,7 +5,9 @@ <%= item.name %> <% form_tag :action => 'add', :id => @region do %> <%= hidden_field_tag :validator_id, item.id %> - <%= submit_tag _('Adicionar') %> + <% button_bar do %> + <%= submit_button('add', _('Add')) %> + <% end %> <% end %> <% end %> diff --git a/app/views/region_validators/region.rhtml b/app/views/region_validators/region.rhtml index dfeffd2..464dcea 100644 --- a/app/views/region_validators/region.rhtml +++ b/app/views/region_validators/region.rhtml @@ -19,7 +19,9 @@ <% form_tag({}, { :method => 'get' }) do %> <%= text_field_tag :search, nil, :id => 'search_validator' %> - <%= submit_tag _('Search') %> + <% button_bar do %> + <%= submit_button('search', _('Search')) %> + <% end %> <% end %> <%= observe_field 'search_validator', :url => { :action => 'search', :id => @region.id }, :with => 'search', :frequency => 1, :update => 'search_results' %> diff --git a/app/views/role/_form.rhtml b/app/views/role/_form.rhtml index 58809cd..66225a7 100644 --- a/app/views/role/_form.rhtml +++ b/app/views/role/_form.rhtml @@ -9,6 +9,7 @@ <%= labelled_form_field(permission_name(p), (check_box_tag "role[permissions][]", p, @role.has_permission?(p))) %> <% end %> - <%= display_submit_tag (mode == :edit) ? _('Save changes') : _('Create role')%> - <%= link_to _('Cancel'), :action => 'index' %> + <% button_bar do %> + <%= submit_button('save', (mode == :edit) ? _('Save changes') : _('Create role'), :cancel => {:action => 'index'} ) %> + <% end %> <% end %> -- libgit2 0.21.2