summaryrefslogtreecommitdiffstats
path: root/app
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
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')
-rw-r--r--app/controllers/issues_controller.rb22
-rw-r--r--app/helpers/journals_helper.rb11
-rw-r--r--app/views/issues/_history.rhtml3
-rw-r--r--app/views/issues/show.rhtml6
4 files changed, 36 insertions, 6 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?
diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb
index 234bfabc0..92d6e5593 100644
--- a/app/helpers/journals_helper.rb
+++ b/app/helpers/journals_helper.rb
@@ -19,13 +19,16 @@ module JournalsHelper
def render_notes(journal, options={})
content = ''
editable = journal.editable_by?(User.current)
- if editable && !journal.notes.blank?
- links = []
+ links = []
+ if !journal.notes.blank?
links << link_to_in_place_notes_editor(image_tag('edit.png'), "journal-#{journal.id}-notes",
{ :controller => 'journals', :action => 'edit', :id => journal },
- :title => l(:button_edit))
- content << content_tag('div', links.join(' '), :class => 'contextual')
+ :title => l(:button_edit)) if editable
+ links << link_to_remote(image_tag('comment.png'),
+ { :url => {:controller => 'issues', :action => 'reply', :id => journal.journalized, :journal_id => journal} },
+ :title => l(:button_reply)) if options[:reply_links]
end
+ content << content_tag('div', links.join(' '), :class => 'contextual') unless links.empty?
content << textilizable(journal, :notes)
content_tag('div', content, :id => "journal-#{journal.id}-notes", :class => (editable ? 'wiki editable' : 'wiki'))
end
diff --git a/app/views/issues/_history.rhtml b/app/views/issues/_history.rhtml
index f29a44daf..b8efdb400 100644
--- a/app/views/issues/_history.rhtml
+++ b/app/views/issues/_history.rhtml
@@ -1,3 +1,4 @@
+<% reply_links = authorize_for('issues', 'edit') -%>
<% for journal in journals %>
<div id="change-<%= journal.id %>" class="journal">
<h4><div style="float:right;"><%= link_to "##{journal.indice}", :anchor => "note-#{journal.indice}" %></div>
@@ -8,6 +9,6 @@
<li><%= show_detail(detail) %></li>
<% end %>
</ul>
- <%= render_notes(journal) unless journal.notes.blank? %>
+ <%= render_notes(journal, :reply_links => reply_links) unless journal.notes.blank? %>
</div>
<% end %>
diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml
index f788d0ec8..f1c8a82cd 100644
--- a/app/views/issues/show.rhtml
+++ b/app/views/issues/show.rhtml
@@ -56,6 +56,12 @@ end %>
</table>
<hr />
+<div class="contextual">
+<%= link_to_remote(image_tag('comment.png'),
+ { :url => {:controller => 'issues', :action => 'reply', :id => @issue} },
+ :title => l(:button_reply)) if authorize_for('issues', 'edit') %>
+</div>
+
<p><strong><%=l(:field_description)%></strong></p>
<div class="wiki">
<%= textilizable @issue, :description, :attachments => @issue.attachments %>