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

69 lines
2.7 KiB
Ruby
Raw Permalink 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|
{
2014-10-03 06:14:59 +00:00
"member" => (experience.member_profile.name rescue ""),
2014-07-03 04:53:14 +00:00
"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-08-01 11:47:16 +00:00
plugin = Experience.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [
2015-01-09 07:43:19 +00:00
"experience_type",
2014-08-01 11:47:16 +00:00
"organizationt_title",
2015-01-09 07:43:19 +00:00
"duration",
2014-08-01 11:47:16 +00:00
"department",
"job_title",
2015-01-09 07:43:19 +00:00
"url"
2014-08-01 11:47:16 +00:00
]
2014-07-03 04:53:14 +00:00
2014-08-01 11:47:16 +00:00
{"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,
2014-07-03 04:53:14 +00:00
2014-08-01 11:47:16 +00:00
# "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")
# }
2014-07-03 04:53:14 +00:00
end
end