##// END OF EJS Templates
Adds a Reply link to each issue note (#739). Reply is pre-filled with the quoted note....
Jean-Philippe Lang -
r1466:5d2abb84bdcb
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -19,7 +19,7 class IssuesController < ApplicationController
19 layout 'base'
19 layout 'base'
20 menu_item :new_issue, :only => :new
20 menu_item :new_issue, :only => :new
21
21
22 before_filter :find_issue, :only => [:show, :edit, :destroy_attachment]
22 before_filter :find_issue, :only => [:show, :edit, :reply, :destroy_attachment]
23 before_filter :find_issues, :only => [:bulk_edit, :move, :destroy]
23 before_filter :find_issues, :only => [:bulk_edit, :move, :destroy]
24 before_filter :find_project, :only => [:new, :update_form, :preview]
24 before_filter :find_project, :only => [:new, :update_form, :preview]
25 before_filter :authorize, :except => [:index, :changes, :preview, :update_form, :context_menu]
25 before_filter :authorize, :except => [:index, :changes, :preview, :update_form, :context_menu]
@@ -208,6 +208,26 class IssuesController < ApplicationController
208 flash.now[:error] = l(:notice_locking_conflict)
208 flash.now[:error] = l(:notice_locking_conflict)
209 end
209 end
210
210
211 def reply
212 journal = Journal.find(params[:journal_id]) if params[:journal_id]
213 if journal
214 user = journal.user
215 text = journal.notes
216 else
217 user = @issue.author
218 text = @issue.description
219 end
220 content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
221 content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub("\n", "\n> ") + "\n\n"
222 render(:update) { |page|
223 page.replace_html "notes", content
224 page.show 'update'
225 page << "Form.Element.focus('notes');"
226 page << "Element.scrollTo('update');"
227 page << "$('notes').scrollTop = $('notes').scrollHeight - $('notes').clientHeight;"
228 }
229 end
230
211 # Bulk edit a set of issues
231 # Bulk edit a set of issues
212 def bulk_edit
232 def bulk_edit
213 if request.post?
233 if request.post?
@@ -19,13 +19,16 module JournalsHelper
19 def render_notes(journal, options={})
19 def render_notes(journal, options={})
20 content = ''
20 content = ''
21 editable = journal.editable_by?(User.current)
21 editable = journal.editable_by?(User.current)
22 if editable && !journal.notes.blank?
22 links = []
23 links = []
23 if !journal.notes.blank?
24 links << link_to_in_place_notes_editor(image_tag('edit.png'), "journal-#{journal.id}-notes",
24 links << link_to_in_place_notes_editor(image_tag('edit.png'), "journal-#{journal.id}-notes",
25 { :controller => 'journals', :action => 'edit', :id => journal },
25 { :controller => 'journals', :action => 'edit', :id => journal },
26 :title => l(:button_edit))
26 :title => l(:button_edit)) if editable
27 content << content_tag('div', links.join(' '), :class => 'contextual')
27 links << link_to_remote(image_tag('comment.png'),
28 { :url => {:controller => 'issues', :action => 'reply', :id => journal.journalized, :journal_id => journal} },
29 :title => l(:button_reply)) if options[:reply_links]
28 end
30 end
31 content << content_tag('div', links.join(' '), :class => 'contextual') unless links.empty?
29 content << textilizable(journal, :notes)
32 content << textilizable(journal, :notes)
30 content_tag('div', content, :id => "journal-#{journal.id}-notes", :class => (editable ? 'wiki editable' : 'wiki'))
33 content_tag('div', content, :id => "journal-#{journal.id}-notes", :class => (editable ? 'wiki editable' : 'wiki'))
31 end
34 end
@@ -1,3 +1,4
1 <% reply_links = authorize_for('issues', 'edit') -%>
1 <% for journal in journals %>
2 <% for journal in journals %>
2 <div id="change-<%= journal.id %>" class="journal">
3 <div id="change-<%= journal.id %>" class="journal">
3 <h4><div style="float:right;"><%= link_to "##{journal.indice}", :anchor => "note-#{journal.indice}" %></div>
4 <h4><div style="float:right;"><%= link_to "##{journal.indice}", :anchor => "note-#{journal.indice}" %></div>
@@ -8,6 +9,6
8 <li><%= show_detail(detail) %></li>
9 <li><%= show_detail(detail) %></li>
9 <% end %>
10 <% end %>
10 </ul>
11 </ul>
11 <%= render_notes(journal) unless journal.notes.blank? %>
12 <%= render_notes(journal, :reply_links => reply_links) unless journal.notes.blank? %>
12 </div>
13 </div>
13 <% end %>
14 <% end %>
@@ -56,6 +56,12 end %>
56 </table>
56 </table>
57 <hr />
57 <hr />
58
58
59 <div class="contextual">
60 <%= link_to_remote(image_tag('comment.png'),
61 { :url => {:controller => 'issues', :action => 'reply', :id => @issue} },
62 :title => l(:button_reply)) if authorize_for('issues', 'edit') %>
63 </div>
64
59 <p><strong><%=l(:field_description)%></strong></p>
65 <p><strong><%=l(:field_description)%></strong></p>
60 <div class="wiki">
66 <div class="wiki">
61 <%= textilizable @issue, :description, :attachments => @issue.attachments %>
67 <%= textilizable @issue, :description, :attachments => @issue.attachments %>
@@ -621,3 +621,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
621 label_and_its_subprojects: %s and its subprojects
621 label_and_its_subprojects: %s and its subprojects
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_subject_reminder: "%d issue(s) due in the next days"
623 mail_subject_reminder: "%d issue(s) due in the next days"
624 text_user_wrote: '%s wrote:'
@@ -626,3 +626,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
626 label_and_its_subprojects: %s and its subprojects
626 label_and_its_subprojects: %s and its subprojects
627 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
627 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
628 mail_subject_reminder: "%d issue(s) due in the next days"
628 mail_subject_reminder: "%d issue(s) due in the next days"
629 text_user_wrote: '%s wrote:'
@@ -623,3 +623,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
623 label_and_its_subprojects: %s and its subprojects
623 label_and_its_subprojects: %s and its subprojects
624 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
625 mail_subject_reminder: "%d issue(s) due in the next days"
625 mail_subject_reminder: "%d issue(s) due in the next days"
626 text_user_wrote: '%s wrote:'
@@ -622,3 +622,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
622 label_and_its_subprojects: %s and its subprojects
622 label_and_its_subprojects: %s and its subprojects
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_subject_reminder: "%d issue(s) due in the next days"
624 mail_subject_reminder: "%d issue(s) due in the next days"
625 text_user_wrote: '%s wrote:'
@@ -596,6 +596,7 text_destroy_time_entries_question: %.02f hours were reported on the issues you
596 text_destroy_time_entries: Delete reported hours
596 text_destroy_time_entries: Delete reported hours
597 text_assign_time_entries_to_project: Assign reported hours to the project
597 text_assign_time_entries_to_project: Assign reported hours to the project
598 text_reassign_time_entries: 'Reassign reported hours to this issue:'
598 text_reassign_time_entries: 'Reassign reported hours to this issue:'
599 text_user_wrote: '%s wrote:'
599
600
600 default_role_manager: Manager
601 default_role_manager: Manager
601 default_role_developper: Developer
602 default_role_developper: Developer
@@ -624,3 +624,4 text_subprojects_destroy_warning: 'Sus subprojectos: %s también se eliminarán'
624 label_and_its_subprojects: %s and its subprojects
624 label_and_its_subprojects: %s and its subprojects
625 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
625 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
626 mail_subject_reminder: "%d issue(s) due in the next days"
626 mail_subject_reminder: "%d issue(s) due in the next days"
627 text_user_wrote: '%s wrote:'
@@ -621,3 +621,4 text_subprojects_destroy_warning: 'Tämän alaprojekti(t): %s tullaan myös pois
621 label_and_its_subprojects: %s and its subprojects
621 label_and_its_subprojects: %s and its subprojects
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_subject_reminder: "%d issue(s) due in the next days"
623 mail_subject_reminder: "%d issue(s) due in the next days"
624 text_user_wrote: '%s wrote:'
@@ -596,6 +596,7 text_destroy_time_entries_question: %.02f heures ont été enregistrées sur les
596 text_destroy_time_entries: Supprimer les heures
596 text_destroy_time_entries: Supprimer les heures
597 text_assign_time_entries_to_project: Reporter les heures sur le projet
597 text_assign_time_entries_to_project: Reporter les heures sur le projet
598 text_reassign_time_entries: 'Reporter les heures sur cette demande:'
598 text_reassign_time_entries: 'Reporter les heures sur cette demande:'
599 text_user_wrote: '%s a écrit:'
599
600
600 default_role_manager: Manager
601 default_role_manager: Manager
601 default_role_developper: Développeur
602 default_role_developper: Développeur
@@ -621,3 +621,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
621 label_and_its_subprojects: %s and its subprojects
621 label_and_its_subprojects: %s and its subprojects
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_subject_reminder: "%d issue(s) due in the next days"
623 mail_subject_reminder: "%d issue(s) due in the next days"
624 text_user_wrote: '%s wrote:'
@@ -622,3 +622,4 enumeration_doc_categories: Dokumentum kategóriák
622 enumeration_activities: Tevékenységek (idő rögzítés)
622 enumeration_activities: Tevékenységek (idő rögzítés)
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_subject_reminder: "%d issue(s) due in the next days"
624 mail_subject_reminder: "%d issue(s) due in the next days"
625 text_user_wrote: '%s wrote:'
@@ -621,3 +621,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
621 label_and_its_subprojects: %s and its subprojects
621 label_and_its_subprojects: %s and its subprojects
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_subject_reminder: "%d issue(s) due in the next days"
623 mail_subject_reminder: "%d issue(s) due in the next days"
624 text_user_wrote: '%s wrote:'
@@ -622,3 +622,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
622 label_and_its_subprojects: %s and its subprojects
622 label_and_its_subprojects: %s and its subprojects
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_subject_reminder: "%d issue(s) due in the next days"
624 mail_subject_reminder: "%d issue(s) due in the next days"
625 text_user_wrote: '%s wrote:'
@@ -621,3 +621,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
621 label_and_its_subprojects: %s and its subprojects
621 label_and_its_subprojects: %s and its subprojects
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_subject_reminder: "%d issue(s) due in the next days"
623 mail_subject_reminder: "%d issue(s) due in the next days"
624 text_user_wrote: '%s wrote:'
@@ -623,3 +623,4 label_and_its_subprojects: %s projektas ir jo subprojektai
623
623
624 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
625 mail_subject_reminder: "%d issue(s) due in the next days"
625 mail_subject_reminder: "%d issue(s) due in the next days"
626 text_user_wrote: '%s wrote:'
@@ -622,3 +622,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
622 label_and_its_subprojects: %s and its subprojects
622 label_and_its_subprojects: %s and its subprojects
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_subject_reminder: "%d issue(s) due in the next days"
624 mail_subject_reminder: "%d issue(s) due in the next days"
625 text_user_wrote: '%s wrote:'
@@ -622,3 +622,4 enumeration_doc_categories: Dokument-kategorier
622 enumeration_activities: Aktiviteter (tidssporing)
622 enumeration_activities: Aktiviteter (tidssporing)
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_subject_reminder: "%d issue(s) due in the next days"
624 mail_subject_reminder: "%d issue(s) due in the next days"
625 text_user_wrote: '%s wrote:'
@@ -621,3 +621,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
621 label_and_its_subprojects: %s and its subprojects
621 label_and_its_subprojects: %s and its subprojects
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_subject_reminder: "%d issue(s) due in the next days"
623 mail_subject_reminder: "%d issue(s) due in the next days"
624 text_user_wrote: '%s wrote:'
@@ -621,3 +621,4 label_age: Age
621 label_and_its_subprojects: %s and its subprojects
621 label_and_its_subprojects: %s and its subprojects
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_subject_reminder: "%d issue(s) due in the next days"
623 mail_subject_reminder: "%d issue(s) due in the next days"
624 text_user_wrote: '%s wrote:'
@@ -621,3 +621,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
621 label_and_its_subprojects: %s and its subprojects
621 label_and_its_subprojects: %s and its subprojects
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_subject_reminder: "%d issue(s) due in the next days"
623 mail_subject_reminder: "%d issue(s) due in the next days"
624 text_user_wrote: '%s wrote:'
@@ -621,3 +621,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
621 label_and_its_subprojects: %s and its subprojects
621 label_and_its_subprojects: %s and its subprojects
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
622 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_subject_reminder: "%d issue(s) due in the next days"
623 mail_subject_reminder: "%d issue(s) due in the next days"
624 text_user_wrote: '%s wrote:'
@@ -625,3 +625,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
625 label_and_its_subprojects: %s and its subprojects
625 label_and_its_subprojects: %s and its subprojects
626 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
626 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
627 mail_subject_reminder: "%d issue(s) due in the next days"
627 mail_subject_reminder: "%d issue(s) due in the next days"
628 text_user_wrote: '%s wrote:'
@@ -622,3 +622,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
622 label_and_its_subprojects: %s and its subprojects
622 label_and_its_subprojects: %s and its subprojects
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_subject_reminder: "%d issue(s) due in the next days"
624 mail_subject_reminder: "%d issue(s) due in the next days"
625 text_user_wrote: '%s wrote:'
@@ -622,3 +622,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
622 label_and_its_subprojects: %s and its subprojects
622 label_and_its_subprojects: %s and its subprojects
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_subject_reminder: "%d issue(s) due in the next days"
624 mail_subject_reminder: "%d issue(s) due in the next days"
625 text_user_wrote: '%s wrote:'
@@ -624,3 +624,4 enumeration_activities: กิจกรรม (ใช้ในการติด
624 label_and_its_subprojects: %s and its subprojects
624 label_and_its_subprojects: %s and its subprojects
625 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
625 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
626 mail_subject_reminder: "%d issue(s) due in the next days"
626 mail_subject_reminder: "%d issue(s) due in the next days"
627 text_user_wrote: '%s wrote:'
@@ -623,3 +623,4 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
623 label_and_its_subprojects: %s and its subprojects
623 label_and_its_subprojects: %s and its subprojects
624 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
625 mail_subject_reminder: "%d issue(s) due in the next days"
625 mail_subject_reminder: "%d issue(s) due in the next days"
626 text_user_wrote: '%s wrote:'
@@ -622,3 +622,4 enumeration_doc_categories: 文件分類
622 enumeration_activities: 活動 (時間追蹤)
622 enumeration_activities: 活動 (時間追蹤)
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
623 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_subject_reminder: "%d issue(s) due in the next days"
624 mail_subject_reminder: "%d issue(s) due in the next days"
625 text_user_wrote: '%s wrote:'
@@ -622,3 +622,4 enumeration_doc_categories: 文档类别
622 enumeration_activities: 活动(时间跟踪)
622 enumeration_activities: 活动(时间跟踪)
623 mail_subject_reminder: "%d issue(s) due in the next days"
623 mail_subject_reminder: "%d issue(s) due in the next days"
624 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
624 mail_body_reminder: "%d issue(s) that are assigned to you are due in the next %d days:"
625 text_user_wrote: '%s wrote:'
@@ -32,9 +32,9 Redmine::AccessControl.map do |map|
32 :queries => :index,
32 :queries => :index,
33 :reports => :issue_report}, :public => true
33 :reports => :issue_report}, :public => true
34 map.permission :add_issues, {:issues => :new}
34 map.permission :add_issues, {:issues => :new}
35 map.permission :edit_issues, {:issues => [:edit, :bulk_edit, :destroy_attachment]}
35 map.permission :edit_issues, {:issues => [:edit, :reply, :bulk_edit, :destroy_attachment]}
36 map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
36 map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
37 map.permission :add_issue_notes, {:issues => :edit}
37 map.permission :add_issue_notes, {:issues => [:edit, :reply]}
38 map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin
38 map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin
39 map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin
39 map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin
40 map.permission :move_issues, {:issues => :move}, :require => :loggedin
40 map.permission :move_issues, {:issues => :move}, :require => :loggedin
@@ -263,6 +263,22 class IssuesControllerTest < Test::Unit::TestCase
263 :content => 'Urgent',
263 :content => 'Urgent',
264 :attributes => { :selected => 'selected' } }
264 :attributes => { :selected => 'selected' } }
265 end
265 end
266
267 def test_reply_to_issue
268 @request.session[:user_id] = 2
269 get :reply, :id => 1
270 assert_response :success
271 assert_select_rjs :show, "update"
272 assert_select_rjs :replace_html, "notes"
273 end
274
275 def test_reply_to_note
276 @request.session[:user_id] = 2
277 get :reply, :id => 1, :journal_id => 2
278 assert_response :success
279 assert_select_rjs :show, "update"
280 assert_select_rjs :replace_html, "notes"
281 end
266
282
267 def test_post_edit
283 def test_post_edit
268 @request.session[:user_id] = 2
284 @request.session[:user_id] = 2
General Comments 0
You need to be logged in to leave comments. Login now