summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-05-30 17:42:25 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-05-30 17:42:25 +0000
commit5d2abb84bdcb8724e5d24a5299bb90f0770f6c23 (patch)
tree9c0616c2916434d808a461fe0bbef2f7e29ce6f5 /app/controllers
parent88dea1a06d833067e5a6d9668c4b6829e027a9f5 (diff)
downloadredmine-5d2abb84bdcb8724e5d24a5299bb90f0770f6c23.tar.gz
redmine-5d2abb84bdcb8724e5d24a5299bb90f0770f6c23.zip
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
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/issues_controller.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index ca3309c46..defc0a11e 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -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?