From 3abf19eb2df8e9a8af36ff521f0c66896c4e632f Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 5 May 2012 17:57:28 +0200 Subject: [PATCH] Improved see more feature. --- .../app/controllers/agent_ticket_zoom.js.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 5941ae5dc..bcb2b8db3 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_zoom.js.coffee @@ -73,7 +73,7 @@ class Index extends App.Controller # cleanup body article['html'] = article.body.trim() article['html'].replace(/\n\r/g, "\n"); - article['html'].replace(/\n\n/mg, "\n"); + article['html'].replace(/\n\n\n/g, "\n\n"); # if body has more then x lines / else search for signature preview = 15 @@ -81,7 +81,10 @@ class Index extends App.Controller article_lines = article['html'].split(/\n/) if article_lines.length > preview preview_mode = true - article_lines.splice( preview, 0, "----SEEMORE----" ) + if article_lines[preview] is '' + article_lines.splice( preview-1, 0, "----SEEMORE----" ) + else + article_lines.splice( preview, 0, "----SEEMORE----" ) article['html'] = article_lines.join("\n") article['html'] = window.linkify( article['html'] ) notify = "" + T('See more') + ""