personal-experience/app/controllers/personal_experiences_contro...

59 lines
2.4 KiB
Ruby
Raw Normal View History

2014-07-03 04:53:14 +00:00
class PersonalExperiencesController < ApplicationController
def index
2014-07-18 07:02:35 +00:00
experiences = Experience.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:53:14 +00:00
experience_list = experiences.collect do |experience|
{
"member" => experience.member_profile.name,
"duration" => experience.duration,
"organizationt_title" => experience.organizationt_title,
"department" => experience.department,
"job_title" => experience.job_title,
"link_to_show" => OrbitHelper.url_to_show(experience.to_param)
}
end
{
"experiences" => experience_list,
"extras" => {
"widget-title" => t("module_name.personal_experience"),
"th_member" => t('users.name'),
"th_duration" => t('personal_experience.duration'),
"th_organizationt_title" => t('personal_experience.organizationt_title'),
"th_department" => t('personal_experience.department'),
"th_job_title" => t('personal_experience.job_title'),
"th_detail" => t('detail')
2014-07-18 07:02:35 +00:00
},
"total_pages" => experiences.total_pages
2014-07-03 04:53:14 +00:00
}
end
def show
params = OrbitHelper.params
2014-07-03 11:31:50 +00:00
experience = Experience.where(:is_hidden=>false).find_by(uid: params[:uid])
2014-07-03 04:53:14 +00:00
{
"organizationt_title" => experience.organizationt_title,
"department" => experience.department,
"job_title" => experience.job_title,
2014-07-15 11:01:46 +00:00
"experience_type" => (experience.experience_type.title rescue ""),
2014-07-03 04:53:14 +00:00
"language" => t(experience.language),
"start_date" => experience.start_date,
"end_date" => experience.end_date,
"duration" => experience.duration,
"keywords" => experience.keywords,
"url" => experience.url,
"note" => experience.note,
"th_organizationt_title" =>t("personal_experience.organizationt_title") ,
"th_department" =>t("personal_experience.department") ,
"th_job_title" =>t("personal_experience.job_title") ,
"th_experience_type" =>t("personal_experience.experience_category") ,
"th_language" =>t("personal_experience.language") ,
"th_start_date" =>t("personal_experience.start_date") ,
"th_end_date" =>t("personal_experience.end_date") ,
"th_duration" =>t("personal_experience.duration") ,
"th_keywords" =>t("personal_experience.keywords") ,
"th_url" =>t("personal_experience.url") ,
"th_note" =>t("personal_experience.note")
}
end
end