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

71 lines
2.7 KiB
Ruby

class PersonalExperiencesController < ApplicationController
def index
experiences = Experience.where(:is_hidden=>false).order_by(:end_date=>'desc',:start_date=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
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')
},
"total_pages" => experiences.total_pages
}
end
def show
params = OrbitHelper.params
plugin = Experience.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [
"organizationt_title",
"department",
"job_title",
"experience_type",
"duration",
"keywords",
"url",
"note"
]
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
# {
# "organizationt_title" => experience.organizationt_title,
# "department" => experience.department,
# "job_title" => experience.job_title,
# "experience_type" => (experience.experience_type.title rescue ""),
# "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