From c5e23bb635f580721e6e11217f336d5e7f122cd8 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Fri, 23 Oct 2015 16:29:39 +0200 Subject: [PATCH] refactor ticket:openTextarea --- .../ticket_zoom/article_new.coffee | 96 ++++++++++--------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee index 915a6a61a..69e5463d8 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee @@ -368,62 +368,64 @@ class App.TicketZoomArticleNew extends App.Controller @removeTextareaCatcher() openTextarea: (event, withoutAnimation) => - if !@articleNewEdit.hasClass('is-open') - duration = 300 + if @articleNewEdit.hasClass('is-open') + return + + duration = 300 - if withoutAnimation - duration = 0 + if withoutAnimation + duration = 0 - @articleNewEdit.addClass('is-open') + @articleNewEdit.addClass('is-open') - @textarea.velocity - properties: - minHeight: "#{ @textareaHeight.open - 38 }px" - options: - duration: duration - easing: 'easeOutQuad' - complete: => @addTextareaCatcher() - - @textBubble.velocity - properties: - paddingBottom: 28 - options: - duration: duration - easing: 'easeOutQuad' - - # scroll to bottom - @textarea.velocity 'scroll', - container: @textarea.scrollParent() - offset: 99999 - duration: 300 + @textarea.velocity + properties: + minHeight: "#{ @textareaHeight.open - 38 }px" + options: + duration: duration easing: 'easeOutQuad' - queue: false + complete: => @addTextareaCatcher() - @editControlItem - .removeClass('is-hidden') - .velocity - properties: - opacity: [ 1, 0 ] - translateX: [ 0, 20 ] - translateZ: 0 - options: - duration: 300 - stagger: 50 - drag: true + @textBubble.velocity + properties: + paddingBottom: 28 + options: + duration: duration + easing: 'easeOutQuad' - # move attachment text to the left bottom (bottom happens automatically) - @attachmentPlaceholder.velocity + # scroll to bottom + @textarea.velocity 'scroll', + container: @textarea.scrollParent() + offset: 99999 + duration: 300 + easing: 'easeOutQuad' + queue: false + + @editControlItem + .removeClass('is-hidden') + .velocity properties: - translateX: -@attachmentInputHolder.position().left + 'px' + opacity: [ 1, 0 ] + translateX: [ 0, 20 ] + translateZ: 0 options: - duration: duration - easing: 'easeOutQuad' + duration: 300 + stagger: 50 + drag: true - @attachmentHint.velocity - properties: - opacity: 0 - options: - duration: duration + # move attachment text to the left bottom (bottom happens automatically) + @attachmentPlaceholder.velocity + properties: + translateX: -@attachmentInputHolder.position().left + 'px' + options: + duration: duration + easing: 'easeOutQuad' + + @attachmentHint.velocity + properties: + opacity: 0 + options: + duration: duration addTextareaCatcher: => if @articleNewEdit.is(':visible')