Implemented issue #571 - Original e-mail inclusion at the bottom of sent e-mails.
This commit is contained in:
parent
f723357f77
commit
bd061fb5c1
4 changed files with 92 additions and 5 deletions
|
@ -391,6 +391,7 @@ class App.TicketZoomArticleActions extends App.Controller
|
||||||
body = @el.closest('.ticketZoom').find('.article-add [data-name="body"]').html() || ''
|
body = @el.closest('.ticketZoom').find('.article-add [data-name="body"]').html() || ''
|
||||||
|
|
||||||
# check if quote need to be added
|
# check if quote need to be added
|
||||||
|
signaturePosition = 'bottom'
|
||||||
selected = App.ClipBoard.getSelected('html')
|
selected = App.ClipBoard.getSelected('html')
|
||||||
if selected
|
if selected
|
||||||
selected = App.Utils.htmlCleanup(selected).html()
|
selected = App.Utils.htmlCleanup(selected).html()
|
||||||
|
@ -399,6 +400,16 @@ class App.TicketZoomArticleActions extends App.Controller
|
||||||
if selected
|
if selected
|
||||||
selected = App.Utils.textCleanup(selected)
|
selected = App.Utils.textCleanup(selected)
|
||||||
selected = App.Utils.text2html(selected)
|
selected = App.Utils.text2html(selected)
|
||||||
|
|
||||||
|
# full quote, if needed
|
||||||
|
if !selected && article && App.Config.get('ui_ticket_zoom_article_email_full_quote')
|
||||||
|
signaturePosition = 'top'
|
||||||
|
if article.content_type.match('html')
|
||||||
|
selected = App.Utils.textCleanup(article.body)
|
||||||
|
if article.content_type.match('plain')
|
||||||
|
selected = App.Utils.textCleanup(selected)
|
||||||
|
selected = App.Utils.text2html(selected)
|
||||||
|
|
||||||
if selected
|
if selected
|
||||||
selected = "<div><br><br/></div><div><blockquote type=\"cite\">#{selected}</blockquote></div><div><br></div>"
|
selected = "<div><br><br/></div><div><blockquote type=\"cite\">#{selected}</blockquote></div><div><br></div>"
|
||||||
|
|
||||||
|
@ -409,7 +420,12 @@ class App.TicketZoomArticleActions extends App.Controller
|
||||||
|
|
||||||
type = App.TicketArticleType.findByAttribute(name:'email')
|
type = App.TicketArticleType.findByAttribute(name:'email')
|
||||||
|
|
||||||
App.Event.trigger('ui::ticket::setArticleType', { ticket: @ticket, type: type, article: articleNew } )
|
App.Event.trigger('ui::ticket::setArticleType', {
|
||||||
|
ticket: @ticket
|
||||||
|
type: type
|
||||||
|
article: articleNew
|
||||||
|
signaturePosition: signaturePosition
|
||||||
|
})
|
||||||
|
|
||||||
telegramPersonalMessageReply: (e) =>
|
telegramPersonalMessageReply: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
|
@ -59,7 +59,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
@$('[name="' + key + '"]').val(value).trigger('change')
|
@$('[name="' + key + '"]').val(value).trigger('change')
|
||||||
|
|
||||||
# preselect article type
|
# preselect article type
|
||||||
@setArticleType(data.type.name)
|
@setArticleType(data.type.name, data.signaturePosition)
|
||||||
|
|
||||||
# set focus at end of field
|
# set focus at end of field
|
||||||
if data.position is 'end'
|
if data.position is 'end'
|
||||||
|
@ -483,7 +483,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
|
|
||||||
@$('[name=internal]').val('')
|
@$('[name=internal]').val('')
|
||||||
|
|
||||||
setArticleType: (type) =>
|
setArticleType: (type, signaturePosition = 'bottom') =>
|
||||||
wasScrolledToBottom = @isScrolledToBottom()
|
wasScrolledToBottom = @isScrolledToBottom()
|
||||||
@type = type
|
@type = type
|
||||||
@$('[name=type]').val(type).trigger('change')
|
@$('[name=type]').val(type).trigger('change')
|
||||||
|
@ -532,6 +532,9 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
body.append('<br><br>')
|
body.append('<br><br>')
|
||||||
signature = $("<div data-signature=\"true\" data-signature-id=\"#{signature.id}\">#{signatureFinished}</div>")
|
signature = $("<div data-signature=\"true\" data-signature-id=\"#{signature.id}\">#{signatureFinished}</div>")
|
||||||
App.Utils.htmlStrip(signature)
|
App.Utils.htmlStrip(signature)
|
||||||
|
if signaturePosition is 'top'
|
||||||
|
body.prepend(signature)
|
||||||
|
else
|
||||||
body.append(signature)
|
body.append(signature)
|
||||||
@$('[data-name=body]').replaceWith(body)
|
@$('[data-name=body]').replaceWith(body)
|
||||||
|
|
||||||
|
@ -566,6 +569,20 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
@delay(@updateLetterCount, 600)
|
@delay(@updateLetterCount, 600)
|
||||||
@$('.js-textSizeLimit').removeClass('hide')
|
@$('.js-textSizeLimit').removeClass('hide')
|
||||||
|
|
||||||
|
# convert remote src images to data uri
|
||||||
|
@$('[data-name=body] img').each( (i,image) ->
|
||||||
|
$image = $(image)
|
||||||
|
src = $image.attr('src')
|
||||||
|
if !_.isEmpty(src) && !src.match(/^data:image/i)
|
||||||
|
canvas = document.createElement('canvas')
|
||||||
|
canvas.width = image.width
|
||||||
|
canvas.height = image.height
|
||||||
|
ctx = canvas.getContext('2d')
|
||||||
|
ctx.drawImage(image, 0, 0)
|
||||||
|
dataURL = canvas.toDataURL()
|
||||||
|
$image.attr('src', dataURL)
|
||||||
|
)
|
||||||
|
|
||||||
@scrollToBottom() if wasScrolledToBottom
|
@scrollToBottom() if wasScrolledToBottom
|
||||||
|
|
||||||
isScrolledToBottom: ->
|
isScrolledToBottom: ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class TicketZoomSetting < ActiveRecord::Migration
|
class TicketZoomSetting2 < ActiveRecord::Migration
|
||||||
def up
|
def up
|
||||||
|
|
||||||
# return if it's a new setup
|
# return if it's a new setup
|
||||||
|
@ -67,6 +67,33 @@ class TicketZoomSetting < ActiveRecord::Migration
|
||||||
},
|
},
|
||||||
frontend: true
|
frontend: true
|
||||||
)
|
)
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
title: 'Email - full quote',
|
||||||
|
name: 'ui_ticket_zoom_article_email_full_quote',
|
||||||
|
area: 'UI::TicketZoom',
|
||||||
|
description: 'Enable if you want to quote the full email in your answer. The quoted email will be put at the end of your answer. If you just want to quote a certain phrase, just mark the text and press reply (this feature is always available).',
|
||||||
|
options: {
|
||||||
|
form: [
|
||||||
|
{
|
||||||
|
display: '',
|
||||||
|
null: true,
|
||||||
|
name: 'ui_ticket_zoom_article_email_full_quote',
|
||||||
|
tag: 'boolean',
|
||||||
|
translate: true,
|
||||||
|
options: {
|
||||||
|
true => 'yes',
|
||||||
|
false => 'no',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
state: false,
|
||||||
|
preferences: {
|
||||||
|
prio: 220,
|
||||||
|
permission: ['admin.ui'],
|
||||||
|
},
|
||||||
|
frontend: true
|
||||||
|
)
|
||||||
Setting.create_if_not_exists(
|
Setting.create_if_not_exists(
|
||||||
title: 'Twitter - tweet initials',
|
title: 'Twitter - tweet initials',
|
||||||
name: 'ui_ticket_zoom_article_twitter_initials',
|
name: 'ui_ticket_zoom_article_twitter_initials',
|
|
@ -600,6 +600,33 @@ Setting.create_if_not_exists(
|
||||||
},
|
},
|
||||||
frontend: true
|
frontend: true
|
||||||
)
|
)
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
title: 'Email - full quote',
|
||||||
|
name: 'ui_ticket_zoom_article_email_full_quote',
|
||||||
|
area: 'UI::TicketZoom',
|
||||||
|
description: 'Enable if you want to quote the full email in your answer. The quoted email will be put at the end of your answer. If you just want to quote a certain phrase, just mark the text and press reply (this feature is always available).',
|
||||||
|
options: {
|
||||||
|
form: [
|
||||||
|
{
|
||||||
|
display: '',
|
||||||
|
null: true,
|
||||||
|
name: 'ui_ticket_zoom_article_email_full_quote',
|
||||||
|
tag: 'boolean',
|
||||||
|
translate: true,
|
||||||
|
options: {
|
||||||
|
true => 'yes',
|
||||||
|
false => 'no',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
state: false,
|
||||||
|
preferences: {
|
||||||
|
prio: 220,
|
||||||
|
permission: ['admin.ui'],
|
||||||
|
},
|
||||||
|
frontend: true
|
||||||
|
)
|
||||||
Setting.create_if_not_exists(
|
Setting.create_if_not_exists(
|
||||||
title: 'Twitter - tweet initials',
|
title: 'Twitter - tweet initials',
|
||||||
name: 'ui_ticket_zoom_article_twitter_initials',
|
name: 'ui_ticket_zoom_article_twitter_initials',
|
||||||
|
|
Loading…
Reference in a new issue