2017-09-21 12:53:58 +00:00
|
|
|
class InternationalRecruitsController < ApplicationController
|
|
|
|
def index
|
|
|
|
countries = []
|
|
|
|
session = OrbitHelper.request.session
|
|
|
|
InternationalCountry::LIST.keys.each do |countrykey|
|
|
|
|
countries << [InternationalCountry::LIST[countrykey], countrykey]
|
|
|
|
end
|
|
|
|
years = (0..10).collect do |x|
|
2017-09-21 13:49:01 +00:00
|
|
|
t = x == 10 ? x.to_s + " plus years" : x.to_s
|
2017-09-21 12:53:58 +00:00
|
|
|
[t, x]
|
|
|
|
end
|
2017-09-21 13:49:01 +00:00
|
|
|
login_url = "/#{I18n.locale.to_s}" + (Page.where(:module => "pseudo_member").first.url rescue "")
|
2017-09-21 12:53:58 +00:00
|
|
|
{
|
|
|
|
"application" => RecruitApplication.new,
|
|
|
|
"countries" => countries,
|
|
|
|
"years" => years,
|
2017-09-21 13:49:01 +00:00
|
|
|
"member" => session["current_pseudo_user_id"],
|
|
|
|
"login_url" => login_url
|
2017-09-21 12:53:58 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def application_success
|
|
|
|
{}
|
|
|
|
end
|
|
|
|
|
|
|
|
def submitapplication
|
|
|
|
ra = RecruitApplication.new(application_params)
|
|
|
|
ra.save
|
|
|
|
page = Page.where(:module => "international_recruit").first
|
|
|
|
redirect_to "/#{I18n.locale.to_s}#{page.url}?method=application_success"
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def application_params
|
|
|
|
params.require(:recruit_application).permit!
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|