ActiveAdmin.register JamRuby::CrashDump, :as => 'Crash Dump' do
  # Note: a lame thing is it's not obvious how to make it search on email instead of user_id.
  filter :timestamp
  filter :client_id
  filter :user_id

  menu :parent => 'Misc'

  config.sort_order = 'created_at DESC'

  index do
    column 'User' do |oo| oo.user ? link_to(oo.user.email, oo.user.admin_url, {:title => oo.user.email}) : '' end
    column "Client Version", :client_version
    column "Client Type", :client_type
    column "Crash Context", :crash_context
    column "File Size", :fsize
    column "Download" do |post|
      link_to 'Link', post.sign_url
    end
    column "Timestamp" do |post|
      (post.timestamp || post.created_at).strftime('%b %d %Y, %H:%M')
    end
    column "Description" do |post|
      post.description
    end
    actions

  end
end
