Fixed reset of new article on reset form.
This commit is contained in:
parent
0dc05ce65e
commit
eac41c1ab7
1 changed files with 19 additions and 16 deletions
|
@ -969,8 +969,8 @@ class ArticleNew extends App.Controller
|
||||||
'click .recipient-list': 'stopPropagation'
|
'click .recipient-list': 'stopPropagation'
|
||||||
'click .list-entry-type div': 'change_type'
|
'click .list-entry-type div': 'change_type'
|
||||||
'submit .recipient-list form': 'add_recipient'
|
'submit .recipient-list form': 'add_recipient'
|
||||||
'focus .js-textarea': 'open_textarea'
|
'focus .js-textarea': 'openTextarea'
|
||||||
'input .js-textarea': 'detect_empty_textarea'
|
'input .js-textarea': 'detectEmptyTextarea'
|
||||||
#'dragenter': 'onDragenter'
|
#'dragenter': 'onDragenter'
|
||||||
#'dragleave': 'onDragleave'
|
#'dragleave': 'onDragleave'
|
||||||
#'drop': 'onFileDrop'
|
#'drop': 'onFileDrop'
|
||||||
|
@ -1028,15 +1028,16 @@ class ArticleNew extends App.Controller
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
if @defaults.body or @isIE10()
|
if @defaults.body or @isIE10()
|
||||||
@open_textarea(null, true)
|
@openTextarea(null, true)
|
||||||
|
|
||||||
|
# set article type and expand text area
|
||||||
@bind(
|
@bind(
|
||||||
'ui::ticket::setArticleType'
|
'ui::ticket::setArticleType'
|
||||||
(data) =>
|
(data) =>
|
||||||
if data.ticket.id is @ticket.id
|
if data.ticket.id is @ticket.id
|
||||||
#@setArticleType(data.type.name)
|
#@setArticleType(data.type.name)
|
||||||
|
|
||||||
@open_textarea(null, true)
|
@openTextarea(null, true)
|
||||||
for key, value of data.article
|
for key, value of data.article
|
||||||
if key is 'body'
|
if key is 'body'
|
||||||
@$('[data-name="' + key + '"]').html(value)
|
@$('[data-name="' + key + '"]').html(value)
|
||||||
|
@ -1047,10 +1048,12 @@ class ArticleNew extends App.Controller
|
||||||
@setArticleType( 'email' )
|
@setArticleType( 'email' )
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# reset new article screen
|
||||||
@bind(
|
@bind(
|
||||||
'ui::ticket::taskReset'
|
'ui::ticket::taskReset'
|
||||||
(data) =>
|
(data) =>
|
||||||
if data.ticket_id is @ticket.id
|
if data.ticket_id is @ticket.id
|
||||||
|
@type = 'note'
|
||||||
@render()
|
@render()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1290,13 +1293,13 @@ class ArticleNew extends App.Controller
|
||||||
else
|
else
|
||||||
@$('[data-name="body"]').find("[data-signature=true]").remove()
|
@$('[data-name="body"]').find("[data-signature=true]").remove()
|
||||||
|
|
||||||
detect_empty_textarea: =>
|
detectEmptyTextarea: =>
|
||||||
if !@textarea.text().trim()
|
if !@textarea.text().trim()
|
||||||
@add_textarea_catcher()
|
@addTextareaCatcher()
|
||||||
else
|
else
|
||||||
@remove_textarea_catcher()
|
@removeTextareaCatcher()
|
||||||
|
|
||||||
open_textarea: (event, withoutAnimation) =>
|
openTextarea: (event, withoutAnimation) =>
|
||||||
console.log('articleNewEdit', @articleNewEdit.hasClass('is-open'))
|
console.log('articleNewEdit', @articleNewEdit.hasClass('is-open'))
|
||||||
if !@articleNewEdit.hasClass('is-open')
|
if !@articleNewEdit.hasClass('is-open')
|
||||||
duration = 300
|
duration = 300
|
||||||
|
@ -1312,7 +1315,7 @@ class ArticleNew extends App.Controller
|
||||||
options:
|
options:
|
||||||
duration: duration
|
duration: duration
|
||||||
easing: 'easeOutQuad'
|
easing: 'easeOutQuad'
|
||||||
complete: => @add_textarea_catcher()
|
complete: => @addTextareaCatcher()
|
||||||
|
|
||||||
@textBubble.velocity
|
@textBubble.velocity
|
||||||
properties:
|
properties:
|
||||||
|
@ -1348,20 +1351,20 @@ class ArticleNew extends App.Controller
|
||||||
options:
|
options:
|
||||||
duration: duration
|
duration: duration
|
||||||
|
|
||||||
add_textarea_catcher: =>
|
addTextareaCatcher: =>
|
||||||
if @articleNewEdit.is(':visible')
|
if @articleNewEdit.is(':visible')
|
||||||
@textareaCatcher = new App.clickCatcher
|
@textareaCatcher = new App.clickCatcher
|
||||||
holder: @articleNewEdit.offsetParent()
|
holder: @articleNewEdit.offsetParent()
|
||||||
callback: @close_textarea
|
callback: @closeTextarea
|
||||||
zIndexScale: 4
|
zIndexScale: 4
|
||||||
|
|
||||||
remove_textarea_catcher: ->
|
removeTextareaCatcher: ->
|
||||||
return if !@textareaCatcher
|
return if !@textareaCatcher
|
||||||
@textareaCatcher.remove()
|
@textareaCatcher.remove()
|
||||||
@textareaCatcher = null
|
@textareaCatcher = null
|
||||||
|
|
||||||
close_textarea: =>
|
closeTextarea: =>
|
||||||
@remove_textarea_catcher()
|
@removeTextareaCatcher()
|
||||||
if !@textarea.text().trim() && !@attachments.length && not @isIE10()
|
if !@textarea.text().trim() && !@attachments.length && not @isIE10()
|
||||||
|
|
||||||
@textarea.velocity
|
@textarea.velocity
|
||||||
|
@ -1397,7 +1400,7 @@ class ArticleNew extends App.Controller
|
||||||
onDragenter: (event) =>
|
onDragenter: (event) =>
|
||||||
# on the first event,
|
# on the first event,
|
||||||
# open textarea (it will only open if its closed)
|
# open textarea (it will only open if its closed)
|
||||||
@open_textarea() if @dragEventCounter is 0
|
@openTextarea() if @dragEventCounter is 0
|
||||||
|
|
||||||
@dragEventCounter++
|
@dragEventCounter++
|
||||||
@articleNewEdit.parent().addClass('is-dropTarget')
|
@articleNewEdit.parent().addClass('is-dropTarget')
|
||||||
|
|
Loading…
Reference in a new issue