=begin
ActiveAdmin.register JamRuby::ScoreHistory, :as => 'Score History' do
  menu :parent => 'Score'

  config.batch_actions = false
  config.sort_order = 'score_dt_desc'
  config.clear_action_items!
  config.filters = true
  config.per_page = 100

  filter :score
  filter :score_dt
  #filter :from_user_id_eq, :as => :autocomplete, :url => "#{Gon.global.prefix}/admin/users/autocomplete_user_email",
  #       :label => "From User", :required => false,
  #       :wrapper_html => { :style => "list-style: none" }

  #autocomplete :user, :email, :full => true, :display_value => :autocomplete_display_name

  filter :from_user_id, as: :string
  filter :from_latency_tester_id
  filter :from_isp
  filter :from_country
  filter :from_region
  filter :from_city
  filter :from_postal
  filter :from_latitude
  filter :from_latitude
  filter :from_longitude
  filter :to_user_id, as: :string
  filter :to_latency_tester_id
  filter :to_isp
  filter :to_country
  filter :to_region
  filter :to_city
  filter :to_postal
  filter :to_latitude
  filter :to_latitude
  filter :to_longitude
  
  before_filter only: :index do
    @per_page = 1_000_000 if request.format == 'text/csv'
  end

  index do
    column "Score", :score
    column "When",  :score_dt
    column "From User", :from_user_id do |score|
        link_to score.from_user, admin_user_path(score.from_user) if score.from_user_id
    end
    column "From Latency Tester", :from_latency_tester_id do |score|
      link_to score.from_latency_tester_id, admin_latency_testers_path if score.from_latency_tester_id
    end
    column "From IP", :from_addr do |score|
      IPAddr.new(score.from_addr,  Socket::AF_INET).to_s if score.from_addr
    end
    column "From ISP", :from_isp
    column "From Country", :from_country
    column "From Region", :from_region
    column "From City", :from_city
    column "From Postal", :from_postal
    column "From Lat", :from_latitude
    column "From Long", :from_longitude
    column "From Client", :from_client_id

    column "To User", :to_user_id do |score|
      link_to score.to_user, admin_user_path(score.to_user) if score.to_user_id
    end
    column "To Latency Tester", :to_latency_tester_id do |score|
      link_to score.to_latency_tester_id, admin_latency_testers_path if score.to_latency_tester_id
    end
    column "To IP", :to_addr do |score|
      IPAddr.new(score.to_addr,  Socket::AF_INET).to_s if score.to_addr
    end
    column "To ISP", :to_isp
    column "To Country", :to_country
    column "To Region", :to_region
    column "To City", :to_city
    column "To Postal", :to_postal
    column "To Lat", :to_latitude
    column "To Long", :to_longitude
    column "To Client", :to_client_id
  end
end
=end
