international_recruit/app/controllers/admin/international_recruits_cont...

51 lines
1.3 KiB
Ruby

class Admin::InternationalRecruitsController < OrbitAdminController
def index
@table_fields = ["international_recruit.member_name", "international_recruit.submited_date", "international_recruit.actions"]
@applications = RecruitApplication.all.desc(:created_at).page(params[:page]).per(10)
end
def destroy
ra = RecruitApplication.find(params[:id])
ra.destroy
redirect_to admin_international_recruits_path
end
def add_course
@course = UniversityCourse.new
end
def create_course
course = UniversityCourse.new(course_params)
course.save
redirect_to courses_admin_international_recruits_path
end
def edit_course
@course = UniversityCourse.find(params[:id])
end
def update_course
course = UniversityCourse.find(params[:id])
course.update_attributes(course_params)
course.save
redirect_to courses_admin_international_recruits_path
end
def courses
@table_fields = ["international_recruit.course_name", "international_recruit.actions"]
@courses = UniversityCourse.all.asc(:created_at)
end
def delete_course
course = UniversityCourse.find(params[:id])
course.destroy
redirect_to courses_admin_international_recruits_path
end
private
def course_params
params.require(:university_course).permit!
end
end