app/helpers/event_groups_helper.rb in whoops-0.1.10 vs app/helpers/event_groups_helper.rb in whoops-0.2
- old
+ new
@@ -9,24 +9,28 @@
all_event_groups = Whoops::EventGroup.all
return @filter_options if @filter_options
@filter_options = Hash.new{|h, k| h[k] = []}
- @filter_options["service"] = Whoops::EventGroup.services.collect{|s| [s, s]}
+ @filter_options["service"] = Whoops::EventGroup.services.to_a
all_event_groups.each do |event_group|
mundane_fields = (Whoops::Filter.field_names & Whoops::EventGroup.field_names) - ["service", "message"]
mundane_fields.each do |field_name|
- @filter_options[field_name] << [event_group.send(field_name), event_group.send(field_name)]
+ @filter_options[field_name] << event_group.send(field_name)
end
end
# add the field name as an empty option
@filter_options.keys.each do |field_name|
@filter_options[field_name].compact!
@filter_options[field_name].sort!{|a, b| a.first <=> b.first}.uniq! if @filter_options[field_name]
- @filter_options[field_name].unshift(["", "--" + field_name.humanize.downcase + " filter--"])
end
@filter_options
+ end
+
+ def filter_checked?(field_name, option)
+ filtered_field = session[:event_group_filter].send(field_name)
+ filtered_field && filtered_field.include?(option)
end
end