]> git.openstreetmap.org Git - rails.git/blobdiff - app/helpers/reports_helper.rb
Move api error handling and timeouts to parent class
[rails.git] / app / helpers / reports_helper.rb
index f9cc996210d7b419267d3879bf123b8c0a45966c..57b786792106f40eab119d2716b98cf8e1417c71 100644 (file)
@@ -1,6 +1,8 @@
 require "ostruct"
 
 module ReportsHelper
 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
   def report_link(name, reportable)
     link_to name, new_report_url(:reportable_id => reportable.id, :reportable_type => reportable.class.name)
   end
@@ -8,7 +10,7 @@ module ReportsHelper
   # 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|
   # 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"))
+      Category.new(c, t(".categories.#{reportable.class.name.underscore}.#{c}_label"))
     end
   end
 end
     end
   end
 end