45 lines
1.3 KiB
Ruby
45 lines
1.3 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
|
|
plugin = Diploma.where(:is_hidden=>false).find_by(uid: params[:uid])
|
|
|
|
fields_to_show = [
|
|
"name",
|
|
"school_name",
|
|
"duration",
|
|
"country",
|
|
"department",
|
|
"degree",
|
|
"url",
|
|
"keywords",
|
|
"note"
|
|
]
|
|
|
|
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
|
end
|
|
end |