From cc179cf6cea5a464ff5fb9f4dd5826264490bc99 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Fri, 4 Dec 2015 14:16:13 +0100 Subject: [PATCH] remove clickCatcher: layout_ref and controller itself --- .../app/controllers/_click_catcher.coffee | 21 ------------------- .../app/controllers/layout_ref.coffee | 20 +++++------------- 2 files changed, 5 insertions(+), 36 deletions(-) delete mode 100644 app/assets/javascripts/app/controllers/_click_catcher.coffee diff --git a/app/assets/javascripts/app/controllers/_click_catcher.coffee b/app/assets/javascripts/app/controllers/_click_catcher.coffee deleted file mode 100644 index a8c9f80aa..000000000 --- a/app/assets/javascripts/app/controllers/_click_catcher.coffee +++ /dev/null @@ -1,21 +0,0 @@ -class App.ClickCatcher extends Spine.Controller - # clickCatcher has no template because it's a plain
- className: 'clickCatcher' - - constructor: -> - super - @render() if @callback and @holder - - triggerCallback: (e) => - e.stopPropagation() - @callback() - @remove() - - render: -> - @el.addClass("zIndex-#{ @zIndexScale }") if @zIndexScale - @el.on('click', @triggerCallback) - @el.height(@holder.prop('scrollHeight')) - @el.appendTo(@holder) - - remove: -> - @el.remove() \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/layout_ref.coffee b/app/assets/javascripts/app/controllers/layout_ref.coffee index a691c9ee0..b19701837 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.coffee @@ -208,6 +208,9 @@ class LayoutRefCommunicationReply extends App.ControllerContent @$('[contenteditable]').textmodule() + release: => + @remove_textarea_catcher() + detect_empty_textarea: => if !@textarea.text() @add_textarea_catcher() @@ -267,15 +270,10 @@ class LayoutRefCommunicationReply extends App.ControllerContent duration: duration add_textarea_catcher: -> - @textareaCatcher = new App.ClickCatcher - holder: @articleNewEdit.offsetParent() - callback: @close_textarea - zIndexScale: 4 + $(window).on 'click.LayoutRefCommunicationReply-textarea', @close_textarea remove_textarea_catcher: -> - return if !@textareaCatcher - @textareaCatcher.remove() - @textareaCatcher = null + $(window).off 'click.LayoutRefCommunicationReply-textarea' close_textarea: => @remove_textarea_catcher() @@ -2151,7 +2149,6 @@ class TwitterConversationRef extends App.ControllerContent options: duration: duration easing: 'easeOutQuad' - complete: => @addTextareaCatcher() @textBubble.velocity properties: @@ -2180,13 +2177,6 @@ class TwitterConversationRef extends App.ControllerContent stagger: 50 drag: true - addTextareaCatcher: => - if @articleNewEdit.is(':visible') - @textareaCatcher = new App.ClickCatcher - holder: @articleNewEdit.offsetParent() - callback: @closeTextarea - zIndexScale: 4 - App.Config.set( 'layout_ref/twitter_conversation', TwitterConversationRef, 'Routes' )