X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d3700e6201b4b78a70bbb2941572edc985b63c2c..e1065adc610f3094a22d43dddad5ffa04338ec38:/app/helpers/reports_helper.rb diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb index 70c9adac6..f9cc99621 100644 --- a/app/helpers/reports_helper.rb +++ b/app/helpers/reports_helper.rb @@ -1,5 +1,14 @@ +require "ostruct" + module ReportsHelper def report_link(name, reportable) link_to name, new_report_url(:reportable_id => reportable.id, :reportable_type => reportable.class.name) end + + # Convert a list of strings into objects with methods that the collection_radio_buttons helper expects + def report_categories(reportable) + Report.categories_for(reportable).map do |c| + OpenStruct.new(:id => c, :label => t(".categories.#{reportable.class.name.underscore}.#{c}_label")) + end + end end