2 def reportable_url(reportable)
3 class_name = reportable.class.name
6 link_to reportable.title, :controller => reportable.class.name.underscore, :action => :view, :display_name => reportable.user.display_name, :id => reportable.id
8 link_to reportable.display_name.to_s, :controller => reportable.class.name.underscore, :action => :view, :display_name => reportable.display_name
10 link_to "#{reportable.diary_entry.title}, Comment id ##{reportable.id}", :controller => reportable.diary_entry.class.name.underscore, :action => :view, :display_name => reportable.diary_entry.user.display_name, :id => reportable.diary_entry.id, :comment_id => reportable.id
12 link_to "Changeset ##{reportable.id}", :controller => :browse, :action => :changeset, :id => reportable.id
14 link_to "Note ##{reportable.id}", :controller => :browse, :action => :note, :id => reportable.id
18 def reports_url(issue)
19 class_name = issue.reportable.class.name
22 link_to issue.reportable.title, issue
24 link_to issue.reportable.display_name.to_s, issue
26 link_to "#{issue.reportable.diary_entry.title}, Comment id ##{issue.reportable.id}", issue
28 link_to "Changeset ##{issue.reportable.id}", issue
30 link_to "Note ##{issue.reportable.id}", issue
34 def instance_url(reportable)
35 class_name = reportable.class.name
38 link_to "Show Instance", :controller => reportable.class.name.underscore, :action => :view, :display_name => reportable.user.display_name, :id => reportable.id
40 link_to "Show Instance", :controller => reportable.class.name.underscore, :action => :view, :display_name => reportable.display_name
42 link_to "Show Instance", :controller => reportable.diary_entry.class.name.underscore, :action => :view, :display_name => reportable.diary_entry.user.display_name, :id => reportable.diary_entry.id, :comment_id => reportable.id
44 link_to "Show Instance", :controller => :browse, :action => :changeset, :id => reportable.id
46 link_to "Show Instance", :controller => :browse, :action => :note, :id => reportable.id
50 def sortable(column, title = nil)
51 title ||= column.titleize
52 direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
53 if column == sort_column
54 arrow = direction == "desc" ? ["25B2".hex].pack("U") : ["25BC".hex].pack("U")
57 link_to title, params.merge(:sort => column, :direction => direction)
60 def report_type(report_class)
63 t("activerecord.models.diary_entry")
65 t("activerecord.models.user")
67 t("activerecord.models.diary_comment")
69 t("activerecord.models.changeset")
71 t("activerecord.models.note")