Adds a Reply link to each issue note (#739). Reply is pre-filled with the quoted note.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1480 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2008-05-30 17:42:25 +00:00
parent 88dea1a06d
commit 5d2abb84bd
34 changed files with 81 additions and 8 deletions
+21 -1
View File
@@ -19,7 +19,7 @@ class IssuesController < ApplicationController
layout 'base'
menu_item :new_issue, :only => :new
before_filter :find_issue, :only => [:show, :edit, :destroy_attachment]
before_filter :find_issue, :only => [:show, :edit, :reply, :destroy_attachment]
before_filter :find_issues, :only => [:bulk_edit, :move, :destroy]
before_filter :find_project, :only => [:new, :update_form, :preview]
before_filter :authorize, :except => [:index, :changes, :preview, :update_form, :context_menu]
@@ -208,6 +208,26 @@ class IssuesController < ApplicationController
flash.now[:error] = l(:notice_locking_conflict)
end
def reply
journal = Journal.find(params[:journal_id]) if params[:journal_id]
if journal
user = journal.user
text = journal.notes
else
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("\n", "\n> ") + "\n\n"
render(:update) { |page|
page.replace_html "notes", content
page.show 'update'
page << "Form.Element.focus('notes');"
page << "Element.scrollTo('update');"
page << "$('notes').scrollTop = $('notes').scrollHeight - $('notes').clientHeight;"
}
end
# Bulk edit a set of issues
def bulk_edit
if request.post?