Browse Source

Moved to richtext for text modules and signatures.

Martin Edenhofer 9 years ago
parent
commit
a526c47b8a

+ 1 - 3
app/assets/javascripts/app/controllers/agent_ticket_create.coffee

@@ -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() || ''

+ 2 - 3
app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee

@@ -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)

+ 0 - 1
app/assets/javascripts/app/lib/base/jquery.textmodule.js

@@ -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)

+ 1 - 1
app/assets/javascripts/app/models/signature.coffee

@@ -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 },

+ 1 - 1
app/assets/javascripts/app/models/text_module.coffee

@@ -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 },
   ]

+ 12 - 0
db/migrate/20160211000001_migrate_text_modules.rb

@@ -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

+ 1 - 1
db/seeds.rb

@@ -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
 )