From f8340b3b3b966324e45788ca734a97bfb707b4ca Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 27 Dec 2014 00:21:28 +0100 Subject: [PATCH] Added content_type to ticket_articles. --- .../javascripts/app/controllers/ticket_zoom.js.coffee | 5 +++++ .../javascripts/app/models/ticket_article.js.coffee | 2 +- db/migrate/20141227000001_update_ticket_article.rb | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20141227000001_update_ticket_article.rb diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index b02887e8e..12ccc8a63 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -579,6 +579,7 @@ class App.TicketZoom extends App.Controller articleParams.from = @Session.get().displayName() articleParams.ticket_id = ticket.id articleParams.form_id = @form_id + articleParams.content_type = 'text/html' if !articleParams['internal'] articleParams['internal'] = false @@ -1508,6 +1509,10 @@ class Article extends App.Controller preview: -> + if @article.content_type is 'text/html' + @article['html'] = @article.body + return + # build html body # cleanup body # @article['html'] = @article.body.trim() diff --git a/app/assets/javascripts/app/models/ticket_article.js.coffee b/app/assets/javascripts/app/models/ticket_article.js.coffee index 3ea788f7d..496d9a265 100644 --- a/app/assets/javascripts/app/models/ticket_article.js.coffee +++ b/app/assets/javascripts/app/models/ticket_article.js.coffee @@ -1,5 +1,5 @@ class App.TicketArticle extends App.Model - @configure 'TicketArticle', 'from', 'to', 'cc', 'subject', 'body', 'ticket_id', 'type_id', 'sender_id', 'internal', 'in_reply_to', 'form_id', 'updated_at' + @configure 'TicketArticle', 'from', 'to', 'cc', 'subject', 'body', 'content_type', 'ticket_id', 'type_id', 'sender_id', 'internal', 'in_reply_to', 'form_id', 'updated_at' @extend Spine.Model.Ajax @url: @apiPath + '/ticket_articles' @configure_attributes = [ diff --git a/db/migrate/20141227000001_update_ticket_article.rb b/db/migrate/20141227000001_update_ticket_article.rb new file mode 100644 index 000000000..069411d58 --- /dev/null +++ b/db/migrate/20141227000001_update_ticket_article.rb @@ -0,0 +1,8 @@ +class UpdateTicketArticle < ActiveRecord::Migration + def up + add_column :ticket_articles, :content_type, :string, :limit => 20, :null => false, :default => 'text/plain' + end + + def down + end +end