From 92e1d50d10576d0dadaa9f9fd37058e05ae397f8 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Tue, 30 Sep 2014 15:55:17 +0200 Subject: [PATCH] fix prefilled article reply --- .../app/controllers/layout_ref.js.coffee | 42 ++++++------------- app/assets/stylesheets/zzz.css.erb | 8 ++-- 2 files changed, 17 insertions(+), 33 deletions(-) diff --git a/app/assets/javascripts/app/controllers/layout_ref.js.coffee b/app/assets/javascripts/app/controllers/layout_ref.js.coffee index 40d3df994..1e8d0e107 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.js.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.js.coffee @@ -10,36 +10,11 @@ App.Config.set( 'layout_ref', Index, 'Routes' ) class Content extends App.ControllerContent - elements: - '.js-textarea' : 'textarea' - '.attachmentPlaceholder': 'attachmentPlaceholder' - '.attachmentPlaceholder-inputHolder': 'attachmentInputHolder' - '.attachmentPlaceholder-hint': 'attachmentHint' - '.ticket-edit': 'ticketEdit' - '.attachments': 'attachmentsHolder' - '.attachmentUpload': 'attachmentUpload' - '.attachmentUpload-progressBar':'progressBar' - '.js-percentage': 'progressText' - - events: - 'hide.bs.dropdown .js-recipientDropdown': 'hideOrganisationMembers' - 'click .js-organisation': 'showOrganisationMembers' - 'click .js-back': 'hideOrganisationMembers' - 'focus .js-textarea': 'open_textarea' - 'input .js-textarea': 'detect_empty_textarea' - 'dragenter': 'onDragenter' - 'dragleave': 'onDragleave' - 'drop': 'onFileDrop' - 'change input[type=file]': 'onFilePick' constructor: -> super @render() - @textareaHeight = - open: 148 - closed: 20 - @dragEventCounter = 0 @attachments = [] @@ -118,6 +93,8 @@ class LayoutRefCommunicationReply extends App.ControllerContent open: 148 closed: 20 + @open_textarea(null, true) if @content + @dragEventCounter = 0 @attachments = [] @@ -192,8 +169,13 @@ class LayoutRefCommunicationReply extends App.ControllerContent else @remove_textarea_catcher() - open_textarea: => - if !@textareaCatcher and !@textarea.text() and !@attachments.length + open_textarea: (event, withoutAnimation) => + if !@ticketEdit.hasClass('is-open') + duration = 300 + + if withoutAnimation + duration = 0 + @ticketEdit.addClass('is-open') @textarea.velocity @@ -201,7 +183,7 @@ class LayoutRefCommunicationReply extends App.ControllerContent minHeight: "#{ @textareaHeight.open - 38 }px" marginBottom: 38 options: - duration: 300 + duration: duration easing: 'easeOutQuad' complete: => @add_textarea_catcher() @@ -224,14 +206,14 @@ class LayoutRefCommunicationReply extends App.ControllerContent properties: translateX: -@attachmentInputHolder.position().left + "px" options: - duration: 300 + duration: duration easing: 'easeOutQuad' @attachmentHint.velocity properties: opacity: 0 options: - duration: 300 + duration: duration add_textarea_catcher: -> @textareaCatcher = new App.clickCatcher diff --git a/app/assets/stylesheets/zzz.css.erb b/app/assets/stylesheets/zzz.css.erb index 61f69638d..b12ebac80 100644 --- a/app/assets/stylesheets/zzz.css.erb +++ b/app/assets/stylesheets/zzz.css.erb @@ -2508,6 +2508,7 @@ footer { padding: 5px; border-radius: 8px; margin: -5px; + overflow: hidden; } .is-internal .internal-border { @@ -2584,7 +2585,8 @@ footer { box-shadow: none; } - .ticket-article-item .attachments:not(:empty) { + .ticket-article-item .attachments { + border-top: 1px solid hsl(0,0%,93%); white-space: normal; margin: 0 -20px; padding: 26px 20px 7px 72px; @@ -2871,10 +2873,10 @@ footer { color: #b3b3b3; } - .attachments:not(:empty) { + .ticket-edit .attachments:not(:empty) { padding: 9px 5px; border-top: 1px solid hsl(0,0%,93%); - margin-bottom: 50px; + margin: 0 -20px 50px; } .attachment {