2014-07-03 04:52:47 +00:00
|
|
|
class PersonalDiplomasController < ApplicationController
|
|
|
|
def index
|
2014-07-18 06:32:13 +00:00
|
|
|
diplomas = Diploma.where(:is_hidden=>false).order_by(:end_date=>'desc', :start_date=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
2014-07-03 04:52:47 +00:00
|
|
|
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')
|
2014-07-18 06:32:13 +00:00
|
|
|
},
|
|
|
|
"total_pages" => diplomas.total_pages
|
2014-07-03 04:52:47 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
params = OrbitHelper.params
|
2014-08-01 11:46:28 +00:00
|
|
|
plugin = Diploma.where(:is_hidden=>false).find_by(uid: params[:uid])
|
2014-07-03 04:52:47 +00:00
|
|
|
|
2014-08-01 11:46:28 +00:00
|
|
|
fields_to_show = [
|
|
|
|
"name",
|
|
|
|
"school_name",
|
|
|
|
"duration",
|
|
|
|
"country",
|
|
|
|
"department",
|
|
|
|
"degree",
|
|
|
|
"url",
|
|
|
|
"keywords",
|
|
|
|
"note"
|
|
|
|
]
|
2014-07-03 04:52:47 +00:00
|
|
|
|
2014-08-01 11:46:28 +00:00
|
|
|
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
2014-07-03 04:52:47 +00:00
|
|
|
end
|
|
|
|
end
|