]> git.openstreetmap.org Git - rails.git/blob - app/helpers/issues_helper.rb
Added support for reporting Changesets + Deleting issues from the CLI
[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                 when "Changeset"
21                         link_to "Changeset ##{reportable.id}, Closed at: #{l(reportable.closed_at.to_datetime, :format => :long)}",             :controller => :browse,
22                                                                                                                                                                                                         :action => :changeset,
23                                                                                                                                                                                                         :id => reportable.id
24                 else
25                         nil
26                 end
27         end
28 end