51 lines
1.4 KiB
Ruby
51 lines
1.4 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|
|
|
member = lab.member_profile
|
|
path = OrbitHelper.url_to_plugin_show(member.to_param, 'member') rescue '#'
|
|
{
|
|
"year" => lab.year,
|
|
"lab_title" => lab.lab_title,
|
|
"location" => lab.location,
|
|
"member" => "<a href='#{path}'>#{member.name}</a>",
|
|
"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 = [
|
|
"year",
|
|
"lab_title",
|
|
"location",
|
|
"participating_professor",
|
|
"participating_student",
|
|
"research_direction",
|
|
"facility",
|
|
"keywords",
|
|
"extension_no",
|
|
"url",
|
|
"note",
|
|
#"owner",
|
|
"file"
|
|
]
|
|
|
|
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
|
end
|
|
end
|