X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/2f9291ba5764fe104264ae7e3b6a361e11212e8b..e94a8a45ba8a51bc5d288e6cda713059a1c6ae1f:/app/helpers/reports_helper.rb?ds=sidebyside 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