]> git.openstreetmap.org Git - rails.git/blob - app/helpers/reports_helper.rb
Store selected map color scheme
[rails.git] / app / helpers / reports_helper.rb
1 require "ostruct"
2
3 module ReportsHelper
4   Category = Struct.new(:id, :label)
5
6   def report_link(name, reportable)
7     link_to name, new_report_url(:reportable_id => reportable.id, :reportable_type => reportable.class.name)
8   end
9
10   # Convert a list of strings into objects with methods that the collection_radio_buttons helper expects
11   def report_categories(reportable)
12     Report.categories_for(reportable).map do |c|
13       Category.new(c, t(".categories.#{reportable.class.name.underscore}.#{c}_label"))
14     end
15   end
16 end