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

56 lines
1.9 KiB
Ruby
Raw Normal View History

2014-07-03 04:52:47 +00:00
class PersonalDiplomasController < ApplicationController
def index
diplomas = Diploma.all
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')
}
}
end
def show
params = OrbitHelper.params
diploma = Diploma.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