Merge pull request #235 from abf/rosa-build:234-disable_submit_button

#234 disabling the submit button to prevent doublicate form submission
This commit is contained in:
avokhmin 2013-07-25 12:25:29 +04:00
commit 8fa95a5194
40 changed files with 39 additions and 194 deletions

View File

@ -15,7 +15,7 @@
.both
.button_block
= submit_tag t("layout.save")
= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}
%span.text_button_padding= t("layout.or")
= link_to t("layout.cancel"), admin_flash_notifies_path, :class => "button"

View File

@ -9,7 +9,7 @@
.rightlist= f.text_field :uname
.leftlist
\ 
.rightlist= submit_tag t("layout.save"), :data => {:"disable-with" => t("layout.saving")}
.rightlist= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}
.both
-else
= render "users/base/form", :f => f

View File

@ -8,8 +8,8 @@
-# TODO: change filter to Backbone.js
%th{:colspan => 3, :rowspan => 1}
= form_tag advisories_path, :method => :get do |f|
= text_field_tag('q', params[:q], :placeholder => t("layout.advisories.search_by_id"), :class => params[:q].present? ? 'black' : 'gray')
%input{:type => 'submit', :value => t("layout.search.header")}
= text_field_tag('q', params[:q], :placeholder => t('layout.advisories.search_by_id'), :class => params[:q].present? ? 'black' : 'gray', :style => 'width:600px;')
= submit_tag t('layout.search.header'), :data => {'disable-with' => t('layout.processing')}
=# link_to t('layout.back'), advisories_path, :class => 'button'
= button_to t('layout.clear'), {:action => :index} , :method => :get

View File

@ -34,7 +34,7 @@
:class => @form.errors.messages[:message].present? ? 'error' : ''
.form-actions
= f.submit t("layout.contact.send_request"), :class => 'button'
= f.submit t('layout.contact.send_request'), :class => 'button', :data => {'disable-with' => t('layout.processing')}
%section.last
%div

View File

@ -30,7 +30,7 @@
.lineForm= select_tag 'role', options_for_collaborators_roles_select
.both
%br
= submit_tag t("layout.add"), :class => 'button'
= submit_tag t('layout.add'), :class => 'button', :data => {'disable-with' => t('layout.processing')}
.hr.bottom
.both

View File

@ -12,5 +12,5 @@
%br
.leftlist
\ 
.rightlist= submit_tag t("layout.save")
.rightlist= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}
.both

View File

@ -1,4 +0,0 @@
.root
= form_tag search_index_path, :method => 'get' do
= text_field_tag 'query', params[:query], :placeholder => t("layout.search.header"), :class => 'exsearch'
= submit_tag t("layout.search.header")

View File

@ -2,7 +2,7 @@
= form_for @platform, :url => platform_content_path(@platform, @path), :html => { :class => :form, :remote => true, :method => :get } do |f|
= tracker_search_field(:term, @term.present? ? @term : t('layout.platforms.search_contents'))
= f.submit t('layout.search.header')
= f.submit t('layout.search.header'), :data => {'disable-with' => t('layout.processing')}
%br
.path= build_content_paths(@platform, @path)

View File

@ -12,4 +12,4 @@
.both
.button_block
= submit_tag t("layout.save")
= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}

View File

@ -12,6 +12,7 @@
= form_tag platform_maintainers_path(@platform), :method => :get do |f|
= text_field_tag('q', params[:q], :placeholder => t("layout.maintainers.search_by_package"), :class => params[:q].present? ? 'black' : 'gray')
%input{:type => 'submit', :value => t("layout.search.header")}
= submit_tag t('layout.search.header'), :data => {'disable-with' => t('layout.processing')}
= button_to t('layout.clear'), {:action => :index} , :method => :get
%tbody

View File

@ -13,7 +13,7 @@
%h3=t('layout.mass_builds.projects_list')
= f.text_area :projects_list
%br
= f.submit t("layout.projects.build_button")
= f.submit t('layout.projects.build_button'), :data => {'disable-with' => t('layout.processing')}
%section.right
%h3= t("activerecord.attributes.build_list.arch")
- Arch.recent.each do |arch|

View File

@ -27,7 +27,7 @@
.both
.button_block
= submit_tag t("layout.save")
= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}
-#%input.button{:type => "submit", :class => "button"}
-#= image_tag("choose.png", :alt => t("layout.save"))
-#= t("layout.clone")

View File

@ -12,6 +12,6 @@
.both
.button_block
= submit_tag t("layout.clone")
= submit_tag t('layout.clon'), :data => {'disable-with' => t('layout.processing')}
%span.text_button_padding= t("layout.or")
= link_to t("layout.cancel"), platform_path(@platform), :class => "button"

View File

@ -11,4 +11,4 @@
= text_field_tag :product_id, params[:product_id]
%br
%br
= submit_tag t("layout.search.header")
= submit_tag t('layout.search.header'), :data => {'disable-with' => t('layout.processing')}

View File

@ -14,7 +14,7 @@
= render 'platforms/products/def_fields', :f => f
= f.submit t("layout.projects.build_button")
= f.submit t('layout.projects.build_button'), :data => {'disable-with' => t('layout.processing')}
%br
%div

View File

@ -41,7 +41,7 @@
= f.select :not_delete, [false, true].collect{|status| [t("layout.#{status}_"), status]}, {:selected => pbl.not_delete}
.both
%br
= submit_tag t('layout.update')
= submit_tag t('layout.update'), :data => {'disable-with' => t('layout.processing')}
.both
- unless pbl.not_delete
.flash_notify

View File

@ -21,7 +21,7 @@
.both
.button_block
= submit_tag t("layout.save")
= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}
%span.text_button_padding= t("layout.or")
= link_to t("layout.cancel"), @product.new_record? ? platform_path(@platform) : platform_product_path(@platform, @product), :class => "button"

View File

@ -12,6 +12,6 @@
.hr
.button_block
= submit_tag t("layout.save")
= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}
%span.text_button_padding= t("layout.or")
= link_to t("layout.cancel"), @repository.new_record? ? platform_repositories_path(@platform) : platform_repository_path(@platform, @repository), :class => "button"

View File

@ -11,6 +11,6 @@
.both
.hr
.button_block
= submit_tag t('layout.save')
= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}
%span.text_button_padding= t('layout.or')
= link_to t('layout.cancel'), platform_tokens_path(@platform), :class => 'button'

View File

@ -56,7 +56,7 @@
%br/
%br/
.butgrp
= f.submit t('layout.search.header')
= f.submit t('layout.search.header'), :data => {'disable-with' => t('layout.processing')}
= f.submit t('reset'), :id => 'filter_clear'
-if @project and can?(:create, @project.build_lists.build)
%input{:id => 'filter_new_build', :type => 'button', :onclick => "location.href='#{new_project_build_list_path(@project)}'", :value => t('layout.build_lists.new_header')}

View File

@ -40,7 +40,7 @@
= f.check_box kind
= f.label kind
%br
= f.submit t("layout.projects.build_button")
= f.submit t('layout.projects.build_button'), :data => {'disable-with' => t('layout.processing')}
.both
%br
= render 'projects/base/submenu'

View File

@ -1,53 +0,0 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.collaborators.list"), project_collaborators_path(@project)
%li.active= link_to t("layout.collaborators.add"), add_project_collaborators_path(@project)
.content
.inner
= form_tag do
%h2.title= t("layout.users.list_header")
%table.table
%tr
%th.first ID
%th= t("activerecord.attributes.user.name")
%th= t("activerecord.attributes.user.email")
%th= t("activerecord.attributes.user.uname")
%th.last= t("layout.collaborators.add")
- @users.each do |user|
%tr{:class => cycle("odd", "even")}
%td
= user.id
%td
= link_to user.name, user_path(user)
%td
= user.email
%td
= user.uname
%td.last
= check_box_tag "user[#{user.id}]", '1', (@project.collaborators.include? user) ? :checked : nil
= label_tag "user[#{user.id}]", t("layout.collaborators.add")
%h2.title= t("layout.groups.list_header")
%table.table
%tr
%th.first ID
%th= t("activerecord.attributes.group.name")
%th= t("activerecord.attributes.group.uname")
%th.last= t("layout.collaborators.add")
- @groups.each do |group|
%tr{:class => cycle("odd", "even")}
%td
= group.id
%td
= link_to group.name, group_path(group)
%td
= group.uname
%td.last
= check_box_tag "group[#{group.id}]", '1', (@project.groups.include? group) ? :checked : nil
= label_tag "group[#{group.id}]", t("layout.collaborators.add")
.group.navform.wat-cf
%button.button{:type => "submit"}
= image_tag("choose.png", :alt => t("layout.save"))
= t("layout.save")
%span.text_button_padding= t("layout.or")
= link_to t("layout.cancel"), project_collaborators_path(@project), :class => "text_button_padding link_button"

View File

@ -1,93 +0,0 @@
-set_meta_tags :title => [title_object(@project), t('layout.projects.members')]
= render 'sidebar'
= render 'submenu'
%a{:name => 'users'}
%h3= t("layout.users.list_header")
= form_tag add_project_collaborators_path(@project) do
.admin-search
= autocomplete_field_tag 'member_id', params[:member_id], autocomplete_user_uname_autocompletes_path, :id_element => '#member_id_field'
.admin-role
.lineForm
= select_tag 'role', options_for_collaborators_roles_select
= hidden_field_tag 'member_id', nil, :id => 'member_id_field'
= submit_tag t("layout.add"), :class => 'button'
.both
= form_tag project_collaborators_path(@project), :id => 'members_form', :delete_url => remove_project_collaborators_path(@project) do
= hidden_field_tag "_method", "post"
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th
\ 
%th
= t("layout.collaborators.members")
%th{:colspan => "3"}
= t("layout.collaborators.roles")
%tbody
- @users.each_with_index do |user, num|
%tr{:id => "admin-table-members-row#{num}"}
%td
%span#niceCheckbox1.niceCheck-main{ :style => "background-position: 0px 0px; "}
= check_box_tag "user_remove[#{user.id}][]"
%td
.img
= image_tag avatar_url(user)
.forimg= link_to user.fullname, user_path(user)
- Relation::ROLES.each_with_index do |role, i|
%td
.radio
= radio_button_tag "user[#{user.id}]", role, ((@project.relations.exists? :actor_id => user.id, :actor_type => 'User', :role => role) ? :checked : nil), :class => 'niceRadio'
.forradio= t("layout.collaborators.role_names.#{ role }")
= link_to_function t("layout.delete_selected"), "deleteAdminMember();", :class => 'button'
= link_to_function t("layout.save"), "saveAdminMember();", :class => 'button right_floated'
.both
%br
.hr.bottom
.both
%a{:name => 'groups'}
%h3= t("layout.groups.list_header")
= form_tag add_project_collaborators_path(@project) do
.admin-search
= autocomplete_field_tag 'group_id', params[:group_id], autocomplete_group_uname_autocompletes_path, :id_element => '#group_id_field'
.admin-role
.lineForm
= select_tag 'role', options_for_collaborators_roles_select, :id => 'group_role'
= hidden_field_tag 'group_id', nil, :id => 'group_id_field'
= submit_tag t("layout.add"), :class => 'button'
.both
= form_tag project_collaborators_path(@project), :id => 'groups_form', :delete_url => remove_project_collaborators_path(@project) do
= hidden_field_tag "_method", "post", :id => 'groups_method'
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th
\ 
%th
= t("layout.collaborators.members")
%th{:colspan => "3"}
= t("layout.collaborators.roles")
%tbody
- @groups.each_with_index do |group, num|
%tr{:id => "admin-table-members-row#{num + @users.size + 1}"}
%td
%span#niceCheckbox1.niceCheck-main{ :style => "background-position: 0px 0px; "}
= check_box_tag "group_remove[#{group.id}][]"
%td
.forimg= link_to "#{group.uname}", group_path(group)
- Relation::ROLES.each_with_index do |role, i|
%td
.radio
= radio_button_tag "group[#{group.id}]", role, ((@project.relations.exists? :actor_id => group.id, :actor_type => 'Group', :role => role) ? :checked : nil), :class => 'niceRadio'
.forradio= t("layout.collaborators.role_names.#{ role }")
= link_to_function t("layout.delete_selected"), "deleteAdminGroup();", :class => 'button'
= link_to_function t("layout.save"), "saveAdminGroup();", :class => 'button right_floated'
.both
.both

View File

@ -1,2 +1,2 @@
=render 'projects/comments/body', :f => f, :id => id
.comment-right= submit_tag t("layout.save")
.comment-right= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}

View File

@ -13,7 +13,7 @@
%br
%br
= submit_tag t("layout.save"), :title => t("layout.save")
= submit_tag t('layout.save'), :title => t('layout.save'), :data => {'disable-with' => t('layout.saving')}
= t("layout.or")
= link_to t("layout.cancel"), blob_path(@project, @treeish, @path), :class => 'button'

View File

@ -7,7 +7,7 @@
= form_for @hook, :url => project_hook_path(@project, @hook), :method => :put, :html => { :class => :form } do |f|
= render 'form'
.actions
= f.submit t('layout.update')
= f.submit t('layout.update'), :data => {'disable-with' => t('layout.processing')}
%br
= render "projects/hooks/docs/#{@hook.name}"

View File

@ -7,7 +7,7 @@
= form_for @hook, :url => project_hooks_path(@project), :method => :post, :html => { :class => :form } do |f|
= render 'form'
.actions
= f.submit t('layout.create')
= f.submit t('layout.create'), :data => {'disable-with' => t('layout.processing')}
%br
= render "projects/hooks/docs/#{@hook.name}"

View File

@ -11,5 +11,5 @@
.both
.leftlist
.rightlist
%input{:type => "submit", :value => t(@issue.new_record? ? 'layout.create' : 'layout.update')}
= submit_tag t(@issue.new_record? ? 'layout.create' : 'layout.update'), :data => {'disable-with' => t('layout.processing')}
.both

View File

@ -71,7 +71,7 @@
.both
.leftlist
\ 
.rightlist= submit_tag t("layout.save"), :class => 'button'
.rightlist= submit_tag t('layout.save'), :class => 'button', :data => {'disable-with' => t('layout.saving')}
.both
:javascript
$(function() {

View File

@ -17,7 +17,7 @@
%br
%span{:style => "font-size: 11px;"}= t("layout.projects.has_wiki_description")
.both
.padd25= submit_tag t("layout.save"), :class => 'button'
.padd25= submit_tag t('layout.save'), :class => 'button', :data => {'disable-with' => t('layout.saving')}
.both
:javascript

View File

@ -21,7 +21,7 @@
=render 'ref_select', :kind => 'to', :project => @pull.to_project, :current => @pull.to_ref
.both
.leftlist.big-list
.rightlist=f.submit t('.update'), :class => 'btn btn-primary disabled', 'data-loading-text' => t('layout.processing'), :style => @pull.already? ? '' : 'display: none;', :id => 'update_pull'
.rightlist=f.submit t('.update'), :class => 'btn btn-primary', :style => @pull.already? ? '' : 'display: none;', :id => 'update_pull', :data => {'disable-with' => t('layout.processing')}
.both
-unless @pull.already?
=f.fields_for :issue do |issue|
@ -39,7 +39,7 @@
.both
.leftlist.big-list
.rightlist
=f.submit t('.submit'), :class => 'btn btn-primary disabled', 'data-loading-text' => t('layout.processing'), :id => 'create_pull' unless @pull.already?
=f.submit t('.submit'), :class => 'btn btn-primary', :id => 'create_pull', :data => {'disable-with' => t('layout.processing')} unless @pull.already?
.both
=render 'diff_commits_tabs' if !@pull.already? && @stats != nil

View File

@ -33,7 +33,7 @@
%span.jaws
%br
= submit_tag t("wiki.save_button"), :id => "gollum-editor-submit", :title => t("wiki.save_changes")
= submit_tag t('wiki.save_button'), :id => 'gollum-editor-submit', :title => t('wiki.save_changes'), :data => {'disable-with' => t('layout.saving')}
= link_to t("wiki.preview"), "javascript:void(0)", :id => "gollum-editor-preview", :class => "minibutton", :title => t("wiki.preview_title"), :'data-url' => preview_project_wiki_index_path(@project)
/ - content_for :javascripts do

View File

@ -1,5 +1,5 @@
= form_tag search_index_path, :method => 'get' do
.leftside= text_field_tag 'query', @query, :placeholder => t("layout.search.header"), :class => 'exsearch'
.lineForm.leftside.rmargin10= select_tag 'type', options_for_select(t('layout.search.types').invert, @type), :class => 'sel80 cusel', :id => 'selSearch'
.leftside= submit_tag t("layout.search.header"), :class => 'button width100'
.leftside= submit_tag t('layout.search.header'), :class => 'button width100', :data => {'disable-with' => t('layout.processing')}
.both

View File

@ -25,8 +25,8 @@
%td.buttons
= link_to "#{remove_member_path}?member_id=#{user.id}", :method => :delete, :confirm => t("layout.confirm") do
%span.delete  
- if can? :remove_memvers, editable_object
= submit_tag t("layout.delete"), :class => 'button'
- if can? :remove_members, editable_object
= submit_tag t("layout.delete"), :class => 'button', :data => {'disable-with' => t('layout.processing')}
.both
- if can? :add_member, editable_object
@ -35,5 +35,5 @@
.admin-search
= autocomplete_field_tag 'member_id', params[:member_id], autocomplete_user_uname_autocompletes_path, :id_element => '#member_id_field'
= hidden_field_tag 'member_id', nil, :id => 'member_id_field'
= submit_tag t("layout.add"), :class => 'button'
= submit_tag t('layout.add'), :class => 'button', :data => {'disable-with' => t('layout.processing')}
.both

View File

@ -1,5 +0,0 @@
= form_tag '#', :method => :get do#platform_repository_path(@platform, @repository), :method => :get do
.group
= label_tag :query, t("layout.search_by_name"), :class => :label
= text_field_tag :query
%button.search{:type => "submit"}= t("layout.search.header")

View File

@ -34,5 +34,5 @@
.both
.leftlist
\ 
.rightlist= submit_tag t("layout.save"), :data => {:"disable-with" => t("layout.saving")}
.rightlist= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}
.both

View File

@ -21,7 +21,7 @@
%br
.leftside.w25
\ 
.leftside.w420= submit_tag t("layout.save")
.leftside.w420= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}
.both
:javascript

View File

@ -13,7 +13,7 @@
.both
.leftlist
\ 
.rightlist= submit_tag t('layout.save')
.rightlist= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}
.both
:javascript

View File

@ -21,6 +21,6 @@
.leftlist= f.label :key, t('activerecord.attributes.ssh_key.key')
.rightlist= f.text_area :key
%br
= f.submit t('layout.add')#, :class => 'button'
= f.submit t('layout.add'), :data => {'disable-with' => t('layout.processing')}
- content_for :sidebar, render('sidebar')

View File

@ -177,7 +177,6 @@ ru:
models:
private_user: Приватный пользователь
product_build_list: Сборочный лист продукта
auto_build_list: Автоматическая пересборка пакетов
attributes:
settings: