ActiveAdmin.register_page "Test Jobs"  do
  menu :parent => 'Misc'

  page_action :long_running, :method => :post do

    puts params.inspect

    time = params[:long_running][:time]

    Resque.enqueue(LongRunning, time)

    redirect_to admin_test_jobs_path, :notice => "Long Running job enqueued."
  end


  content do

    active_admin_form_for LongRunning.new, :url => admin_test_jobs_long_running_path, :builder => ActiveAdmin::FormBuilder do |f|
      f.inputs "Queue a long running job" do
        f.input :time
      end
      f.actions
    end
  end
end
