ActiveAdmin.register_page "Harry Fox Request"  do
  menu :parent => 'JamTracks'

  page_action :create_request, :method => :post do

    name = params[:jam_ruby_jam_track_hfa_request][:name]

    request = JamTrackHfaRequest.create(name)
    redirect_to admin_harry_fox_request_path, :notice => "Request created. Check Amazon S3 in the 'jamkazam' bucket; specifically #{request.request_csv_filename}"
  end


  content do
    active_admin_form_for JamTrackHfaRequest.new, :url => admin_harry_fox_request_create_request_path, :builder => ActiveAdmin::FormBuilder do |f|
        f.inputs "New Harry Fox Licensing Request" do
          f.input :name, :hint => "Some sort of name to help us remember what this request was for"
        end
        f.actions
    end

  end
end
