]> git.openstreetmap.org Git - rails.git/blob - app/helpers/issues_helper.rb
DB changes + Related issues added
[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.id
20
21                 else
22                         nil
23                 end
24         end
25 end