personal-diploma/app/controllers/personal_diplomas_controlle...

57 lines
2.1 KiB
Ruby

class PersonalDiplomasController < ApplicationController
def index
diplomas = Diploma.where(:is_hidden=>false).order_by(:end_date=>'desc', :start_date=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
diploma_list = diplomas.collect do |diploma|
{
"member" => diploma.member_profile.name,
"duration" => diploma.duration,
"school_name" => diploma.school_name,
"degree" => diploma.degree,
"link_to_show" => OrbitHelper.url_to_show(diploma.to_param)
}
end
{
"diplomas" => diploma_list,
"extras" => {
"widget-title" => t("module_name.personal_diploma"),
"th_member" => t('users.name'),
"th_duration" => t('personal_diploma.duration'),
"th_school_name" => t('personal_diploma.school_name'),
"th_degree" => t('personal_diploma.degree'),
"th_detail" => t('detail')
},
"total_pages" => diplomas.total_pages
}
end
def show
params = OrbitHelper.params
diploma = Diploma.where(:is_hidden=>false).find_by(uid: params[:uid])
{
"school_name" => diploma.school_name,
"country" => diploma.country,
"department" => diploma.department,
"degree" => diploma.degree,
"language" => t(diploma.language),
"keywords" => diploma.keywords,
"start_date" => diploma.start_date,
"end_date" => diploma.end_date,
"duration" => diploma.duration,
"url" => diploma.url,
"note" => diploma.note,
"th_school_name" => t("personal_diploma.school_name"),
"th_country" => t("personal_diploma.country"),
"th_department" => t("personal_diploma.department"),
"th_degree" => t("personal_diploma.degree"),
"th_language" => t("personal_diploma.language"),
"th_keywords" => t("personal_diploma.keywords"),
"th_start_date" => t("personal_diploma.start_date"),
"th_end_date" => t("personal_diploma.end_date"),
"th_duration" => t("personal_diploma.duration"),
"th_url" => t("personal_diploma.url"),
"th_note" => t("personal_diploma.note")
}
end
end