]> git.openstreetmap.org Git - rails.git/blob - app/helpers/reports_helper.rb
Merge remote-tracking branch 'upstream/pull/2782'
[rails.git] / app / helpers / reports_helper.rb
1 require "ostruct"
2
3 module ReportsHelper
4   def report_link(name, reportable)
5     link_to name, new_report_url(:reportable_id => reportable.id, :reportable_type => reportable.class.name)
6   end
7
8   # Convert a list of strings into objects with methods that the collection_radio_buttons helper expects
9   def report_categories(reportable)
10     Report.categories_for(reportable).map do |c|
11       OpenStruct.new(:id => c, :label => t(".categories.#{reportable.class.name.underscore}.#{c}_label"))
12     end
13   end
14 end