diff --git a/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee index 05d043433..54c46f0b1 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee @@ -70,17 +70,36 @@ class Index extends App.Controller article = App.TicketArticle.find(article_id) # build html body + # cleanup body article['html'] = article.body.trim() - article['html'].replace(/\n\n/m, "\n"); - article['html'].replace(/\n\r\n\r/m, "\n"); + article['html'].replace(/\n\r/g, "\n"); + article['html'].replace(/\n\n/mg, "\n"); + + # if body has more then x lines / else search for signature + preview = 15 + preview_mode = false + article_lines = article['html'].split(/\n/) + if article_lines.length > preview + preview_mode = true + article_lines.splice( preview+1, 1, "----SEEMORE----" ) + article['html'] = article_lines.join("\n") article['html'] = window.linkify( article['html'] ) notify = "" + T('See more') + "" - @article_changed = false - article['html'] = article['html'].replace /^(--|__)/m, (match) => - @article_changed = true - notify + '