Commit a65775c734571934f3acf2c113e628685f46d95b
1 parent
9b47f92b
Exists in
master
and in
29 other branches
ActionItem121: changed all the submit button of the form to conform with the sta…
…ndard of using the button_bar and the submit_button helpers git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1198 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
28 changed files
with
90 additions
and
51 deletions
Show diff stats
app/design_blocks/list_block/views/edit.rhtml
app/design_blocks/profile_info_block/views/edit.rhtml
app/design_blocks/view_article/views/edit.rhtml
app/helpers/application_helper.rb
... | ... | @@ -179,15 +179,8 @@ module ApplicationHelper |
179 | 179 | def labelled_form_field(label, field_html, field_id = nil) |
180 | 180 | NoosferoFormBuilder::output_field(label, field_html, field_id) |
181 | 181 | end |
182 | - alias_method :display_form_field, :labelled_form_field | |
183 | - | |
184 | - # FIXME: do not use window.history on the cancel button, instead go to the page where the user come from | |
185 | - def display_submit_tag(label, options = {}) | |
186 | - cancel_button = '' | |
187 | - cancel_button = "<input type='button' class='bt_cancel' value='" + _('Cancel') + "' onclick='window.history.back()'> " if options[:with_cancel] | |
188 | - content_tag('p', submit_tag( label, :class => 'submit') + cancel_button, :class => 'submitline') | |
189 | - end | |
190 | 182 | |
183 | + alias_method :display_form_field, :labelled_form_field | |
191 | 184 | |
192 | 185 | def labelled_form_for(name, object = nil, options = {}, &proc) |
193 | 186 | object ||= instance_variable_get("@#{name}") |
... | ... | @@ -278,7 +271,13 @@ module ApplicationHelper |
278 | 271 | end |
279 | 272 | |
280 | 273 | def submit_button(type, label, html_options = {}) |
281 | - design_display_button_submit(type, label, { :class => 'with_text' }.merge(html_options)) | |
274 | + bt_cancel = html_options[:cancel] ? "<input type='button' class='button bt_cancel' value='" + _('Cancel') + "' onclick='document.location.href = \"#{url_for html_options.delete(:cancel)}\"'> " : '' | |
275 | + | |
276 | + html_options[:class] = [html_options[:class], 'submit'].compact.join(' ') | |
277 | + | |
278 | + bt_submit = design_display_button_submit(type, label, { :class => 'with_text' }.merge(html_options)) | |
279 | + content_tag('p', bt_submit + bt_cancel, :class => 'submitline') | |
280 | + | |
282 | 281 | end |
283 | 282 | |
284 | 283 | def button_to_function(type, label, js_code, html_options = {}) | ... | ... |
app/views/account/forgot_password.rhtml
... | ... | @@ -8,7 +8,9 @@ |
8 | 8 | <%= labelled_form_field(_('Username'), (f.text_field :login)) %> |
9 | 9 | <%= labelled_form_field(_('E-mail'), (f.text_field :email)) %> |
10 | 10 | <div> |
11 | - <%= submit_tag _('Send change password procedure by e-mail') %> | |
11 | + <% button_bar do %> | |
12 | + <%= submit_button('send', _('Send change password procedure by e-mail')) %> | |
13 | + <% end %> | |
12 | 14 | </div> |
13 | 15 | |
14 | 16 | <% end %> | ... | ... |
app/views/account/login.rhtml
app/views/account/new_password.rhtml
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | |
11 | 11 | <%= labelled_form_field(_('Enter new password'), (f.password_field :password)) %> |
12 | 12 | <%= labelled_form_field(_('Confirm the new password'), (f.password_field :password_confirmation)) %> |
13 | - <%= submit_tag _('Change password') %> | |
13 | + <% button_bar do %> | |
14 | + <%= submit_button('change_password', _('Change password')) %> | |
15 | + <% end %> | |
14 | 16 | |
15 | 17 | <% end %> | ... | ... |
app/views/account/signup.rhtml
app/views/categories/_form.rhtml
... | ... | @@ -13,6 +13,7 @@ |
13 | 13 | <%= select_color_for_category %> |
14 | 14 | |
15 | 15 | <%= f.text_field 'name' %> |
16 | - <%= display_submit_tag _('Save') %> | |
17 | - <%= link_to _('Cancel'), :action => 'index' %> | |
16 | + <% button_bar do %> | |
17 | + <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %> | |
18 | + <% end%> | |
18 | 19 | <% end %> | ... | ... |
app/views/cms/edit.rhtml
... | ... | @@ -13,6 +13,7 @@ |
13 | 13 | <%# TODO display the tooltip (title below) in a directly visible way %> |
14 | 14 | <%= f.text_field('tag_list', :size => 64, :title => _('Separate tags with commas')) %> |
15 | 15 | |
16 | - <%= design_display_button_submit('save', _('Save')) %> | |
17 | - <%= design_display_button('cancel', _('Cancel'), :action => (@article.parent ? 'view' : 'index'), :id => @article.parent) %> | |
16 | + <% button_bar do %> | |
17 | + <%= submit_button('save', _('Save'), :cancel => [:action => (@article.parent ? 'view' : 'index')], :id => @article.parent) %> | |
18 | + <% end %> | |
18 | 19 | <% end %> | ... | ... |
app/views/consumed_products/new.rhtml
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | <% form_for :consumption, @consumption do |f| %> |
6 | 6 | <p> <%= _('Product:') %> <%= f.select "product_category_id", ProductCategory.find(:all).map{|pc| [pc.name, pc.id]} %></p> |
7 | 7 | <p> <%= _('Aditional specifications:') %><br> <%= f.text_area "aditional_specifications" %> </p> |
8 | - <%= submit_tag _('Add product') %> | |
9 | - <%= link_to _('Cancel'), :action => 'index' %> | |
8 | + <% button_bar do %> | |
9 | + <%= submit_button('add', _('Add product'), :cancel => {:action => 'index'}) %> | |
10 | + <% end %> | |
10 | 11 | <% end %> | ... | ... |
app/views/content_viewer/_comment_form.rhtml
... | ... | @@ -15,5 +15,7 @@ |
15 | 15 | |
16 | 16 | <%= labelled_form_field(_('Title'), text_field(:comment, :title)) %> |
17 | 17 | <%= labelled_form_field(_('Enter your comment'), text_area(:comment, :body)) %> |
18 | - <%= submit_tag _('Post comment') %> | |
18 | + <% button_bar do %> | |
19 | + <%= submit_button('post', _('Post comment')) %> | |
20 | + <% end %> | |
19 | 21 | <% end %> | ... | ... |
app/views/enterprise_editor/edit.rhtml
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | |
5 | 5 | <% form_tag :action => 'update', :id => @enterprise do %> |
6 | 6 | <%= render :partial => 'form' %> |
7 | -<p><%= submit_tag _('Update') %> | |
8 | -<%= link_to _('Cancel'), :action => 'index' %></p> | |
7 | + <% button_bar do %> | |
8 | + <%= submit_button('save', _('Update'), :cancel => {:action => 'index'}) %> | |
9 | + <% end %> | |
9 | 10 | <% end %> | ... | ... |
app/views/enterprise_registration/basic_information.rhtml
... | ... | @@ -29,8 +29,7 @@ |
29 | 29 | <%= f.select('region_id', @regions) %> |
30 | 30 | |
31 | 31 | <% button_bar do %> |
32 | - <%= submit_button('next', _('Next')) %> | |
33 | - <%= button 'cancel', _('Cancel'), :action => 'index' %> | |
32 | + <%= submit_button('next', _('Next'), :cancel => {:action => 'index'}) %> | |
34 | 33 | <% end %> |
35 | 34 | |
36 | 35 | <% end %> | ... | ... |
app/views/enterprise_validation/details.rhtml
... | ... | @@ -15,7 +15,9 @@ |
15 | 15 | <p><%= _('If this enterprise passes the criteria to be considered an solidarity enconomy enterprise, you can approve it by click the button below.') %></p> |
16 | 16 | |
17 | 17 | <% form_tag :action => 'approve', :id => @pending.code do %> |
18 | -<%= submit_tag _('Approve') %> | |
18 | + <% button_bar do %> | |
19 | + <%= submit_button('approve', _('Approve')) %> | |
20 | + <% end %> | |
19 | 21 | <% end %> |
20 | 22 | |
21 | 23 | <h4><%= _('Reject') %></h4> |
... | ... | @@ -25,6 +27,8 @@ |
25 | 27 | <% form_tag :action => 'reject', :id => @pending.code do %> |
26 | 28 | <%= labelled_form_field(_('Please provide an explanation for the rejection. This explanation will be sent to the requestor (required).'), text_area_tag('reject_explanation'))%> |
27 | 29 | <div> |
28 | - <%= submit_tag _('Reject') %> | |
30 | + <% button_bar do %> | |
31 | + <%= submit_button('reject', _('Reject')) %> | |
32 | + <% end %> | |
29 | 33 | </div> |
30 | 34 | <% end %> | ... | ... |
app/views/environment_role_manager/affiliate.rhtml
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <% form_tag( {:action => 'give_role'}, {:method => :post}) do %> |
4 | 4 | <%= select_tag 'role', options_for_select(@roles.map{|r|[r.name,r.id]}) %> |
5 | 5 | <%= hidden_field_tag 'person', current_user.person.id %> |
6 | - <%= submit_tag _('Affiliate') %> | |
6 | + <% button_bar do %> | |
7 | + <%= submit_button('affiliate', _('Affiliate', :cancel => {:action => 'index'}) %> | |
8 | + <% end %> | |
7 | 9 | <% end %> |
8 | - | |
9 | -<%= link_to _('Back'), :action => 'index' %> | ... | ... |
app/views/environment_role_manager/change_role.rhtml
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | <% end %> |
9 | 9 | <%= hidden_field_tag 'person', @admin.id %> |
10 | 10 | |
11 | - <%= display_submit_tag _('Save changes') %> | |
12 | - <%= link_to _('Cancel'), :action => 'index' %> | |
11 | + <% button_bar do %> | |
12 | + <%= submit_button('save', _('Save changes'), :cancel => {:action => 'index'}) %> | |
13 | + <% end %> | |
13 | 14 | <% end %> | ... | ... |
app/views/environment_role_manager/make_admin.rhtml
... | ... | @@ -9,5 +9,7 @@ |
9 | 9 | <% @roles.each do |r| %> |
10 | 10 | <%= labelled_form_field(r.name, (check_box_tag "roles[]", r.id)) %> |
11 | 11 | <% end %> |
12 | -<%= display_submit_tag _('Make') %> | |
12 | + <% button_bar do %> | |
13 | + <%= submit_button( 'save', _('Make'), :cancel => {:action => 'index'} ) %> | |
14 | + <% end %> | |
13 | 15 | <% end %> | ... | ... |
app/views/features/_features_table.rhtml
... | ... | @@ -12,7 +12,9 @@ |
12 | 12 | <%= labelled_form_field(_('Organization Approval Method'), select_organization_approval_method('environment', 'organization_approval_method')) %> |
13 | 13 | |
14 | 14 | <div> |
15 | - <%= submit_tag _('Save changes') %> | |
15 | + <% button_bar do %> | |
16 | + <%= submit_button('save', _('Save changes')) %> | |
17 | + <% end %> | |
16 | 18 | </div> |
17 | 19 | |
18 | 20 | <% end %> | ... | ... |
app/views/manage_products/_form.rhtml
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | <%= display_form_field( _('Description:'), f.text_area(:description) ) %> |
7 | 7 | <%= display_form_field( _('Image:'), file_field_tag( "product[image_builder][uploaded_data]" ) ) %> |
8 | 8 | <%= display_form_field( _('category:'), f.select( :product_category_id,ProductCategory.find(:all).map{|pc|[pc.name,pc.id]}, {:include_blank => true} )) %> |
9 | - <%= display_submit_tag(mode == 'new' ? _('Create product') : _('Save changes')) %> | |
10 | - <%= link_to _('Cancel'), :action => 'index' %> | |
9 | + <% button_bar do %> | |
10 | + <%= submit_button('save', (mode == 'new' ? _('Create product') : _('Save changes')), :cancel => {:action => 'index'} ) %> | |
11 | + <% end %> | |
11 | 12 | <% end %> | ... | ... |
app/views/profile_editor/change_image.rhtml
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | :html => { :multipart => true }, |
3 | 3 | :url => { :action => 'change_image'} do |f| %> |
4 | 4 | <%= display_form_field(_('Image'), f.file_field( :uploaded_data, { :onchange => 'updateImg(this.value)' } ) ) %> |
5 | - <%= display_submit_tag(_('Upload')) %> | |
6 | - <%= link_to _('Cancel'), :action => 'index' %> | |
5 | + <% button_bar do %> | |
6 | + <%= submit_button('save', _('Upload'), :cancel => {:action => 'index'}) %> | |
7 | + <% end %> | |
7 | 8 | <% end %> | ... | ... |
app/views/profile_editor/organization_info.rhtml
... | ... | @@ -5,5 +5,7 @@ |
5 | 5 | <%= f.text_field(:legal_form) %> |
6 | 6 | <%= f.text_field(:economic_activity) %> |
7 | 7 | <%= f.text_area(:management_information) %> |
8 | - <%= display_submit_tag(_('Save'), :with_cancel => true) %> | |
8 | + <% button_bar do %> | |
9 | + <%= submit_button('save' , _('Save'), :cancel => {:action => 'index'}) %> | |
10 | + <% end %> | |
9 | 11 | <% end %> | ... | ... |
app/views/profile_editor/person_info.rhtml
... | ... | @@ -9,6 +9,8 @@ |
9 | 9 | <%= f.text_field(:city) %> |
10 | 10 | <%= f.text_field(:state) %> |
11 | 11 | <%= f.text_field(:country) %> |
12 | - <%= display_submit_tag _('Save') %> | |
12 | + <% button_bar do %> | |
13 | + <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %> | |
14 | + <% end %> | |
13 | 15 | |
14 | 16 | <% end %> | ... | ... |
app/views/profile_members/affiliate.rhtml
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <% form_tag( {:action => 'give_role'}, {:method => :post}) do %> |
4 | 4 | <%= select_tag 'role', options_for_select(@roles.map{|r|[r.name,r.id]}) %> |
5 | 5 | <%= hidden_field_tag 'person', current_user.person.id %> |
6 | - <%= submit_tag _('Affiliate') %> | |
6 | + <% button_bar do %> | |
7 | + <%= submit_button('affiliate', _('Affiliate'), :cancel => {:action => 'index'}) %> | |
8 | + <% end %> | |
7 | 9 | <% end %> |
8 | - | |
9 | -<%= link_to _('Back'), :action => 'index' %> | ... | ... |
app/views/profile_members/change_role.rhtml
... | ... | @@ -9,6 +9,7 @@ |
9 | 9 | <% end %> |
10 | 10 | <%= hidden_field_tag 'person', @member.id %> |
11 | 11 | |
12 | - <%= display_submit_tag _('Save changes') %> | |
13 | - <%= link_to _('Cancel'), :action => 'index' %> | |
12 | + <% button_bar do %> | |
13 | + <%= submit_button('save', _('Save changes'), :cancel => {:action => 'index'}) %> | |
14 | + <% end %> | |
14 | 15 | <% end %> | ... | ... |
app/views/region_validators/_search.rhtml
... | ... | @@ -5,7 +5,9 @@ |
5 | 5 | <%= item.name %> |
6 | 6 | <% form_tag :action => 'add', :id => @region do %> |
7 | 7 | <%= hidden_field_tag :validator_id, item.id %> |
8 | - <%= submit_tag _('Adicionar') %> | |
8 | + <% button_bar do %> | |
9 | + <%= submit_button('add', _('Add')) %> | |
10 | + <% end %> | |
9 | 11 | <% end %> |
10 | 12 | </li> |
11 | 13 | <% end %> | ... | ... |
app/views/region_validators/region.rhtml
... | ... | @@ -19,7 +19,9 @@ |
19 | 19 | |
20 | 20 | <% form_tag({}, { :method => 'get' }) do %> |
21 | 21 | <%= text_field_tag :search, nil, :id => 'search_validator' %> |
22 | - <%= submit_tag _('Search') %> | |
22 | + <% button_bar do %> | |
23 | + <%= submit_button('search', _('Search')) %> | |
24 | + <% end %> | |
23 | 25 | <% end %> |
24 | 26 | |
25 | 27 | <%= observe_field 'search_validator', :url => { :action => 'search', :id => @region.id }, :with => 'search', :frequency => 1, :update => 'search_results' %> | ... | ... |
app/views/role/_form.rhtml
... | ... | @@ -9,6 +9,7 @@ |
9 | 9 | <%= labelled_form_field(permission_name(p), (check_box_tag "role[permissions][]", p, @role.has_permission?(p))) %> |
10 | 10 | <% end %> |
11 | 11 | |
12 | - <%= display_submit_tag (mode == :edit) ? _('Save changes') : _('Create role')%> | |
13 | - <%= link_to _('Cancel'), :action => 'index' %> | |
12 | + <% button_bar do %> | |
13 | + <%= submit_button('save', (mode == :edit) ? _('Save changes') : _('Create role'), :cancel => {:action => 'index'} ) %> | |
14 | + <% end %> | |
14 | 15 | <% end %> | ... | ... |