diff --git a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee index 490f5a18c..9b0f74306 100644 --- a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee +++ b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee @@ -7,6 +7,7 @@ class App.UserOrganizationAutocompletion extends App.Controller 'click .js-user': 'selectUser' 'click .js-userNew': 'newUser' 'focus input': 'open' + 'click': 'stopPropagation' constructor: (params) -> super @@ -25,26 +26,20 @@ class App.UserOrganizationAutocompletion extends App.Controller @el release: => - return if !@catcher - @catcher.remove() + $(window).off 'click.UserOrganizationAutocompletion' open: => @clearDelay('close') @el.addClass('open') - if @catcher - @catcher.remove() - @catcher = new App.ClickCatcher - holder: @el.offsetParent() - callback: @close - zIndexScale: 1 + + $(window).on 'click.UserOrganizationAutocompletion', @close close: => execute = => @el.removeClass('open') @delay( execute, 400, 'close' ) - if @catcher - @catcher.remove() + $(window).off 'click.UserOrganizationAutocompletion' selectUser: (e) -> userId = $(e.target).parents('.recipientList-entry').data('user-id')