forked from saurabh/personal-lab
47 lines
1.3 KiB
Ruby
47 lines
1.3 KiB
Ruby
class PersonalLabsController < ApplicationController
|
|
def index
|
|
labs = Lab.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
|
lab_list = labs.collect do |lab|
|
|
{
|
|
"year" => lab.year,
|
|
"lab_title" => lab.lab_title,
|
|
"location" => lab.location,
|
|
"member" => lab.member_profile.name,
|
|
"link_to_show" => OrbitHelper.url_to_show(lab.to_param)
|
|
}
|
|
end
|
|
{
|
|
"labs" => lab_list,
|
|
"extras" => {
|
|
"widget-title" => t("module_name.personal_lab"),
|
|
"th_year" => t('personal_lab.year'),
|
|
"th_lab_title" => t('module_name.personal_lab'),
|
|
"th_location" => t('personal_lab.location'),
|
|
"th_member" => t('users.name'),
|
|
"th_detail" => t('detail')
|
|
},
|
|
"total_pages" => labs.total_pages
|
|
}
|
|
end
|
|
|
|
def show
|
|
params = OrbitHelper.params
|
|
plugin = Lab.where(:is_hidden=>false).find_by(uid: params[:uid])
|
|
fields_to_show = [
|
|
"lab_title",
|
|
"location",
|
|
"participating_professor",
|
|
"participating_student",
|
|
"research_direction",
|
|
"facility",
|
|
"year",
|
|
"keywords",
|
|
"extension_no",
|
|
"url",
|
|
"note",
|
|
"file"
|
|
]
|
|
|
|
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
|
end
|
|
end |