ActiveAdmin.register JamRuby::AffiliateTrafficTotal, :as => 'Affiliate Daily Stats' do

  menu :label => 'Daily Stats', :parent => 'Affiliates'

  config.sort_order = 'referral_user_count DESC'
  config.batch_actions = false
  config.clear_action_items!
  config.filters = true
  config.per_page = 50
  config.paginate = true

  filter :affiliate_partner
  filter :day
  filter :signups
  filter :visits

  form :partial => 'form'

  scope("Active", default: true) { |scope| scope.where('visits != 0 or signups != 0').order('day desc') }

  index do

    # default_actions # use this for all view/edit/delete links

    column 'Day' do |oo| oo.day end
    column 'Partner' do |oo| link_to(oo.affiliate_partner.display_name, oo.affiliate_partner.admin_url, {:title => oo.affiliate_partner.display_name}) end
    column 'Signups' do |oo| oo.signups end
    column 'Visits' do |oo| oo.visits end

  end


  controller do

  end
end
