Added probing for modal dialog to prevent conflicts of more modal dialogs at same time.

This commit is contained in:
Martin Edenhofer 2018-03-07 16:04:36 +01:00
parent a553e4c118
commit e05c0f6064

View file

@ -676,6 +676,8 @@ class App.ControllerModal extends App.Controller
closeOnAnyClick: false
initalFormParams: {}
initalFormParamsIgnore: false
showTryMax: 10
showTrydelay: 1000
events:
'submit form': 'submit'
@ -687,6 +689,7 @@ class App.ControllerModal extends App.Controller
constructor: ->
super
@showTryCount = 0
if @authenticateRequired
return if !@authenticateCheckRedirect()
@ -699,6 +702,16 @@ class App.ControllerModal extends App.Controller
if @shown
@render()
showDelayed: =>
delay = =>
@showTryCount += 1
@render()
@delay(delay, @showTrydelay)
modalAlreadyExists: ->
return true if $('.modal').length > 0
false
content: ->
'You need to implement a one @content()!'
@ -737,6 +750,10 @@ class App.ControllerModal extends App.Controller
@el
render: =>
if @modalAlreadyExists() && @showTryCount <= @showTryMax
@showDelayed()
return
@initalFormParamsIgnore = false
if @buttonSubmit is true