diff --git a/app/assets/javascripts/app/controllers/_application_controller.coffee b/app/assets/javascripts/app/controllers/_application_controller.coffee index b30d0683f..95d242233 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.coffee @@ -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