remove clickCatcher: layout_ref and controller itself

This commit is contained in:
Felix Niklas 2015-12-04 14:16:13 +01:00
parent 20b41596b6
commit cc179cf6ce
2 changed files with 5 additions and 36 deletions

View file

@ -1,21 +0,0 @@
class App.ClickCatcher extends Spine.Controller
# clickCatcher has no template because it's a plain <div>
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()

View file

@ -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' )