X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/2f9291ba5764fe104264ae7e3b6a361e11212e8b..33c0e95ebea3aeabae694ad5d9f0250dd11b56fb:/app/helpers/reports_helper.rb diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb index 70c9adac6..57b786792 100644 --- a/app/helpers/reports_helper.rb +++ b/app/helpers/reports_helper.rb @@ -1,5 +1,16 @@ +require "ostruct" + module ReportsHelper + Category = Struct.new(:id, :label) + 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| + Category.new(c, t(".categories.#{reportable.class.name.underscore}.#{c}_label")) + end + end end