Merge branch 'develop' of github.com:martini/zammad into develop
This commit is contained in:
commit
ea30b734ad
4 changed files with 29 additions and 23 deletions
|
@ -142,7 +142,10 @@ class App.TicketCreate extends App.Controller
|
||||||
@latestTitle = title
|
@latestTitle = title
|
||||||
App.TaskManager.touch(@task_key)
|
App.TaskManager.touch(@task_key)
|
||||||
|
|
||||||
@interval(update, 3000, @id)
|
@el.on('change.local blur.local keyup.local paste.local input.local', 'form, .js-textarea', (e) =>
|
||||||
|
@delay(update, 250, 'ticket-create-form-update')
|
||||||
|
)
|
||||||
|
@delay(update, 800, 'ticket-create-form-update')
|
||||||
|
|
||||||
# get data / in case also ticket data for split
|
# get data / in case also ticket data for split
|
||||||
buildScreen: (params) =>
|
buildScreen: (params) =>
|
||||||
|
|
|
@ -100,7 +100,7 @@ class App.TicketZoom extends App.Controller
|
||||||
@activeState = true
|
@activeState = true
|
||||||
|
|
||||||
# start autosave
|
# start autosave
|
||||||
@delay(@autosaveStart, 800, "ticket-zoom-auto-save-#{@ticket_id}")
|
@autosaveStart()
|
||||||
|
|
||||||
# if ticket is shown the first time
|
# if ticket is shown the first time
|
||||||
if !@shown
|
if !@shown
|
||||||
|
@ -428,6 +428,7 @@ class App.TicketZoom extends App.Controller
|
||||||
@el.on('change.local blur.local keyup.local paste.local input.local', 'form, .js-textarea', (e) =>
|
@el.on('change.local blur.local keyup.local paste.local input.local', 'form, .js-textarea', (e) =>
|
||||||
@delay(update, 250, 'ticket-zoom-form-update')
|
@delay(update, 250, 'ticket-zoom-form-update')
|
||||||
)
|
)
|
||||||
|
@delay(update, 800, 'ticket-zoom-form-update')
|
||||||
|
|
||||||
currentStore: =>
|
currentStore: =>
|
||||||
return if !@ticket
|
return if !@ticket
|
||||||
|
|
|
@ -23,6 +23,7 @@ class Channel::EmailParser
|
||||||
cc: 'Somebody <somebody@example.com>',
|
cc: 'Somebody <somebody@example.com>',
|
||||||
subject: 'some message subject',
|
subject: 'some message subject',
|
||||||
body: 'some message body',
|
body: 'some message body',
|
||||||
|
date: Time.zone.now,
|
||||||
attachments: [
|
attachments: [
|
||||||
{
|
{
|
||||||
data: 'binary of attachment',
|
data: 'binary of attachment',
|
||||||
|
|
|
@ -92,7 +92,7 @@ class String
|
||||||
link_list = ''
|
link_list = ''
|
||||||
counter = 0
|
counter = 0
|
||||||
if !string_only
|
if !string_only
|
||||||
string.gsub!( /<a\s.*?href=("|')(.+?)("|').*?>/ix ) {
|
string.gsub!(/<a\s.*?href=("|')(.+?)("|').*?>/ix) {
|
||||||
link = $2
|
link = $2
|
||||||
counter = counter + 1
|
counter = counter + 1
|
||||||
link_list += "[#{counter}] #{link}\n"
|
link_list += "[#{counter}] #{link}\n"
|
||||||
|
@ -101,31 +101,32 @@ class String
|
||||||
end
|
end
|
||||||
|
|
||||||
# remove style tags with content
|
# remove style tags with content
|
||||||
string.gsub!( %r{<style(|\s.+?)>(.+?)</style>}im, '')
|
string.gsub!(%r{<style(|\s.+?)>(.+?)</style>}im, '')
|
||||||
|
|
||||||
# remove empty lines
|
# remove empty lines
|
||||||
string.gsub!( /^\s*/m, '' )
|
string.gsub!(/^\s*/m, '')
|
||||||
|
|
||||||
# pre/code handling 1/2
|
# pre/code handling 1/2
|
||||||
string.gsub!( %r{<pre>(.+?)</pre>}m ) { |placeholder|
|
string.gsub!(%r{<pre>(.+?)</pre>}m) { |placeholder|
|
||||||
placeholder = placeholder.gsub(/\n/, '###BR###')
|
placeholder = placeholder.gsub(/\n/, '###BR###')
|
||||||
}
|
}
|
||||||
string.gsub!( %r{<code>(.+?)</code>}m ) { |placeholder|
|
string.gsub!(%r{<code>(.+?)</code>}m) { |placeholder|
|
||||||
placeholder = placeholder.gsub(/\n/, '###BR###')
|
placeholder = placeholder.gsub(/\n/, '###BR###')
|
||||||
}
|
}
|
||||||
|
|
||||||
# insert spaces on [A-z]\n[A-z]
|
# insert spaces on [A-z]\n[A-z]
|
||||||
string.gsub!( /([A-z])\n([A-z])/m, '\1 \2' )
|
string.gsub!(/([A-z])\n([A-z])/m, '\1 \2')
|
||||||
|
|
||||||
# remove all new lines
|
# remove all new lines
|
||||||
string.gsub!(/(\n\r|\r\r\n|\r\n|\n)/, '')
|
string.gsub!(/(\n\r|\r\r\n|\r\n|\n)/, '')
|
||||||
|
|
||||||
# blockquote handling
|
# blockquote handling
|
||||||
string.gsub!( %r{<blockquote(| [^>]*)>(.+?)</blockquote>}m ) {
|
string.gsub!(%r{<blockquote(| [^>]*)>(.+?)</blockquote>}m) {
|
||||||
"\n" + $2.html2text(true).gsub(/^(.*)$/, '> \1') + "\n"
|
"\n" + $2.html2text(true).gsub(/^(.*)$/, '> \1') + "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# pre/code handling 2/2
|
# pre/code handling 2/2
|
||||||
string.gsub!(/###BR###/, "\n" )
|
string.gsub!(/###BR###/, "\n")
|
||||||
|
|
||||||
# add counting
|
# add counting
|
||||||
string.gsub!(/<li(| [^>]*)>/i, "\n* ")
|
string.gsub!(/<li(| [^>]*)>/i, "\n* ")
|
||||||
|
@ -137,14 +138,14 @@ class String
|
||||||
string.gsub!(%r{</h\d>}i, "\n")
|
string.gsub!(%r{</h\d>}i, "\n")
|
||||||
|
|
||||||
# add new lines
|
# add new lines
|
||||||
string.gsub!( %r{</div><div(|\s.+?)>}im, "\n" )
|
string.gsub!(%r{</div><div(|\s.+?)>}im, "\n")
|
||||||
string.gsub!( %r{</p><p(|\s.+?)>}im, "\n" )
|
string.gsub!(%r{</p><p(|\s.+?)>}im, "\n")
|
||||||
string.gsub!( %r{<(div|p|pre|br|table|h)(|/| [^>]*)>}i, "\n" )
|
string.gsub!(%r{<(div|p|pre|br|table|h)(|/| [^>]*)>}i, "\n")
|
||||||
string.gsub!( %r{</(tr|p|br|div)(|\s.+?)>}i, "\n" )
|
string.gsub!(%r{</(tr|p|br|div)(|\s.+?)>}i, "\n")
|
||||||
string.gsub!( %r{</td>}i, ' ' )
|
string.gsub!(%r{</td>}i, ' ')
|
||||||
|
|
||||||
# strip all other tags
|
# strip all other tags
|
||||||
string.gsub!( /\<.+?\>/, '' )
|
string.gsub!(/\<.+?\>/, '')
|
||||||
|
|
||||||
# replace multiple spaces with one
|
# replace multiple spaces with one
|
||||||
string.gsub!(/ /, ' ')
|
string.gsub!(/ /, ' ')
|
||||||
|
@ -156,19 +157,19 @@ class String
|
||||||
rescue
|
rescue
|
||||||
|
|
||||||
# strip all & < > "
|
# strip all & < > "
|
||||||
string.gsub!( '&', '&' )
|
string.gsub!('&', '&')
|
||||||
string.gsub!( '<', '<' )
|
string.gsub!('<', '<')
|
||||||
string.gsub!( '>', '>' )
|
string.gsub!('>', '>')
|
||||||
string.gsub!( '"', '"' )
|
string.gsub!('"', '"')
|
||||||
string.gsub!( ' ', ' ' )
|
string.gsub!(' ', ' ')
|
||||||
|
|
||||||
# encode html entities like "–"
|
# encode html entities like "–"
|
||||||
string.gsub!( /(&\#(\d+);?)/x ) {
|
string.gsub!(/(&\#(\d+);?)/x) {
|
||||||
$2.chr
|
$2.chr
|
||||||
}
|
}
|
||||||
|
|
||||||
# encode html entities like "d;"
|
# encode html entities like "d;"
|
||||||
string.gsub!( /(&\#[xX]([0-9a-fA-F]+);?)/x ) {
|
string.gsub!(/(&\#[xX]([0-9a-fA-F]+);?)/x) {
|
||||||
chr_orig = $1
|
chr_orig = $1
|
||||||
hex = $2.hex
|
hex = $2.hex
|
||||||
if hex
|
if hex
|
||||||
|
|
Loading…
Reference in a new issue