aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haddad2017-03-31 12:47:42 +0200
committerThomas Haddad2017-03-31 12:47:42 +0200
commit8fa4640289fdb8dfa4b9b730a6383711b5503bbf (patch)
tree4b8428d1dcd958bf96bde70eaceaf497b9c024ca
parenta9586d1c2b6cafc615f0b0e9203520621a97b40a (diff)
downloadchouette-core-8fa4640289fdb8dfa4b9b730a6383711b5503bbf.tar.bz2
Refs #3015: Attempt fix submit being fired multiple times
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
-rw-r--r--app/assets/javascripts/forms.coffee18
1 files changed, 10 insertions, 8 deletions
diff --git a/app/assets/javascripts/forms.coffee b/app/assets/javascripts/forms.coffee
index 426f3e6ee..9d884edcd 100644
--- a/app/assets/javascripts/forms.coffee
+++ b/app/assets/javascripts/forms.coffee
@@ -1,3 +1,7 @@
+# IE fix
+isIE = false || !!document.documentMode
+isEdge = !isIE && !!window.StyleMedia
+
@togglableFilter = ->
$('.form-filter').on 'click', '.form-group.togglable', (e)->
if $(e.target).hasClass('togglable') || $(e.target).parent().hasClass('togglable')
@@ -23,17 +27,15 @@
$('.formSubmitr').appendTo('.page-action')
- # IE fix
- isIE = false || !!document.documentMode
- isEdge = !isIE && !!window.StyleMedia
-
if isIE || isEdge
$('.formSubmitr').off()
- $(document).on 'click', '.formSubmitr', (e)->
- e.preventDefault()
- target = $(this).attr('form')
- $('#' + target).submit()
$(document).on 'ready page:load', togglableFilter
$(document).on 'ready page:load', submitMover
$(document).on 'ready page:load', switchInput
+
+if isIE || isEdge
+ $(document).on 'click', '.formSubmitr', (e)->
+ e.preventDefault()
+ target = $(this).attr('form')
+ $('#' + target).submit()