From 4f44edcd8feccd21e7b216e24c86ddc91a31793a Mon Sep 17 00:00:00 2001 From: Billy Zhou Date: Wed, 29 May 2019 10:03:55 +0200 Subject: [PATCH] Fixed #2510 - Zammad Customers shown as Agents in IE. --- .../_application_controller_form.coffee | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.coffee index af92b3deb..7c5e1f5ba 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.coffee @@ -32,11 +32,11 @@ class App.ControllerForm extends App.Controller @form.prepend('') @form.prepend('') - if @handlers - params = App.ControllerForm.params(@form) - for attribute in @attributes - for handler in @handlers - handler(params, attribute, @attributes, @idPrefix, @form, @) + # Fix for Issue #2510 - Zammad Customers shown as Agents in IE + # Previously the handlers are called directly, before the DOM elements are ready, thereby causing a race condition under IE11. + # Now we only dispatch the handlers after the DOM is ready. + if @handlers.length + $(@dispatch_handlers) # if element is given, prepend form to it if @el @@ -52,6 +52,12 @@ class App.ControllerForm extends App.Controller @finishForm = true @form + dispatch_handlers: => + params = App.ControllerForm.params(@form) + for attribute in @attributes + for handler in @handlers + handler(params, attribute, @attributes, @idPrefix, @form, @) + showAlert: (message) => @form.find('.alert--danger').first().removeClass('hide').html(App.i18n.translateInline(message)) @@ -428,6 +434,7 @@ class App.ControllerForm extends App.Controller # get contenteditable for element in lookupForm.find('[contenteditable]') name = $(element).data('name') + if name param[name] = $(element).ceg()