Fixed link to DiaryComments
[rails.git] / app / helpers / issues_helper.rb
1 module IssuesHelper
2
3         def reportable_url(reportable)
4                 class_name = reportable.class.name
5                 case class_name
6                 when "DiaryEntry"
7                         link_to reportable.title,       :controller => reportable.class.name.underscore,
8                                                                                                                                 :action => :view,
9                                                                                                                                 :display_name => reportable.user.display_name,
10                                                                                                                                 :id => reportable.id
11                 when "User"
12                         link_to reportable.display_name.to_s,   :controller => reportable.class.name.underscore,
13                                                                                                                                                                 :action => :view,
14                                                                                                                                                                 :display_name => reportable.display_name
15                 when "DiaryComment"
16                         link_to "#{reportable.diary_entry.title}, Comment id ##{reportable.id}",        :controller => reportable.diary_entry.class.name.underscore,
17                                                                                                                 :action => :view,
18                                                                                                                 :display_name => reportable.diary_entry.user.display_name,
19                                                                                                                 :id => reportable.diary_entry.id,
20                                                                                                                 :comment_id => reportable.id
21                 when "Changeset"
22                         link_to "Changeset ##{reportable.id}, Closed at: #{l(reportable.closed_at.to_datetime, :format => :long)}",             :controller => :browse,
23                                                                                                                                                                                                         :action => :changeset,
24                                                                                                                                                                                                         :id => reportable.id
25                 else
26                         nil
27                 end
28         end
29 end