From 4703060ff7011bca7dee3c2a0f4c1acae940d524 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 5 May 2012 16:52:45 +0200 Subject: [PATCH] Improved show more feature. --- .../app/controllers/agent_ticket_zoom.js.coffee | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 9e1270333..a98a53a2b 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee @@ -70,11 +70,16 @@ class Index extends App.Controller article = App.TicketArticle.find(article_id) # build html body - article['html'] = window.linkify( article.body.trim() ) + article['html'] = article.body.trim() + article['html'].replace(/\n\n/m, "\n"); + article['html'] = window.linkify( article['html'] ) notify = "" + T('See more') + "" - article['html'] = article['html'].replace /--/m, (match) -> + @article_changed = false + article['html'] = article['html'].replace /^(--|__)/m, (match) => notify + '
' + match - article['html'] = article['html'] + '
' + @article_changed = true + if @article_changed + article['html'] = article['html'] + '' @articles.push article