]> source.dussan.org Git - redmine.git/commitdiff
Merged r3616 from trunk.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 11 Apr 2010 14:41:15 +0000 (14:41 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 11 Apr 2010 14:41:15 +0000 (14:41 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3652 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb

index 914dc84003f3d5df13538a9f04bc033a3af408dc..d627f712de4545afda6b88d3c9f0a05fc9372d7d 100644 (file)
@@ -223,10 +223,13 @@ class IssuesController < ApplicationController
       user = @issue.author
       text = @issue.description
     end
-    content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> "
-    content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
+    # Replaces pre blocks with [...]
+    text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
+    content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
+    content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
+      
     render(:update) { |page|
-      page.<< "$('notes').value = \"#{content}\";"
+      page.<< "$('notes').value = \"#{escape_javascript content}\";"
       page.show 'update'
       page << "Form.Element.focus('notes');"
       page << "Element.scrollTo('update');"