]> git.openstreetmap.org Git - rails.git/blobdiff - app/helpers/reports_helper.rb
Restore the grey border around the user image on the profile page
[rails.git] / app / helpers / reports_helper.rb
index 70c9adac6527d59b1140717df537e7c812ef911f..f9cc996210d7b419267d3879bf123b8c0a45966c 100644 (file)
@@ -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
 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
 end