Moved to richtext for text modules and signatures.

This commit is contained in:
Martin Edenhofer 2016-02-11 00:53:48 +01:00
parent 4438cef46a
commit a526c47b8a
7 changed files with 18 additions and 10 deletions

View file

@ -201,9 +201,7 @@ class App.TicketCreate extends App.Controller
type = @$('[name="formSenderType"]').val()
if signature isnt undefined && signature.body && type is 'email-out'
signatureFinished = App.Utils.text2html(
App.Utils.replaceTags( signature.body, { user: App.Session.get() } )
)
signatureFinished = App.Utils.replaceTags( signature.body, { user: App.Session.get() } )
# get current body
body = @$('[data-name="body"]').html() || ''

View file

@ -420,9 +420,8 @@ class App.TicketZoomArticleNew extends App.Controller
@$('[data-name=body] [data-signature="true"]').remove()
# apply new signature
signatureFinished = App.Utils.text2html(
App.Utils.replaceTags( signature.body, { user: App.Session.get(), ticket: ticketCurrent } )
)
signatureFinished = App.Utils.replaceTags( signature.body, { user: App.Session.get(), ticket: ticketCurrent } )
body = @$('[data-name=body]').html() || ''
if App.Utils.signatureCheck(body, signatureFinished)
if !App.Utils.lastLineEmpty(body)

View file

@ -248,7 +248,6 @@
// paste some content
Plugin.prototype.paste = function(string) {
string = App.Utils.text2html(string)
if (document.selection) { // IE
var range = document.selection.createRange()
range.pasteHTML(string)

View file

@ -5,7 +5,7 @@ class App.Signature extends App.Model
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false },
{ name: 'body', display: 'Text', tag: 'textarea', limit: 250, 'null': true, rows: 10 },
{ name: 'body', display: 'Text', tag: 'richtext', limit: 500, 'null': true, rows: 10 },
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true },
{ name: 'active', display: 'Active', tag: 'active', default: true },
{ name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 },

View file

@ -5,7 +5,7 @@ class App.TextModule extends App.Model
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false },
{ name: 'keywords', display: 'Keywords', tag: 'input', type: 'text', limit: 100, null: true },
{ name: 'content', display: 'Content', tag: 'textarea', limit: 250, null: false },
{ name: 'content', display: 'Content', tag: 'richtext', limit: 2000, null: false },
{ name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 },
{ name: 'active', display: 'Active', tag: 'active', default: true },
]

View file

@ -0,0 +1,12 @@
class MigrateTextModules < ActiveRecord::Migration
def up
TextModule.all.each {|text_module|
text_module.content = text_module.content.text2html
text_module.save
}
Signature.all.each {|signature|
signature.body = signature.body.text2html
signature.save
}
end
end

View file

@ -1516,7 +1516,7 @@ signature = Signature.create_if_not_exists(
Super Support - Waterford Business Park
5201 Blue Lagoon Drive - 8th Floor & 9th Floor - Miami, 33126 USA
Email: hot@example.com - Web: http://www.example.com/
--',
--'.text2html,
updated_by_id: 1,
created_by_id: 1
)