personal-lab/app/controllers/personal_labs_controller.rb

51 lines
1.4 KiB
Ruby
Raw Normal View History

2014-07-03 11:25:50 +00:00
class PersonalLabsController < ApplicationController
def index
2014-07-18 07:04:34 +00:00
labs = Lab.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
2014-07-03 11:25:50 +00:00
lab_list = labs.collect do |lab|
member = lab.member_profile
path = OrbitHelper.url_to_plugin_show(member.to_param, 'member') rescue '#'
2014-07-03 11:25:50 +00:00
{
"year" => lab.year,
"lab_title" => lab.lab_title,
"location" => lab.location,
"member" => "<a href='#{path}'>#{member.name}</a>",
2014-07-03 11:25:50 +00:00
"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')
2014-07-18 07:04:34 +00:00
},
"total_pages" => labs.total_pages
2014-07-03 11:25:50 +00:00
}
end
def show
params = OrbitHelper.params
2014-08-01 11:48:33 +00:00
plugin = Lab.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [
2015-01-09 07:45:32 +00:00
"year",
2014-08-01 11:48:33 +00:00
"lab_title",
"location",
"participating_professor",
"participating_student",
"research_direction",
"facility",
"keywords",
"extension_no",
"url",
"note",
#"owner",
2014-08-01 11:48:33 +00:00
"file"
]
2014-07-03 11:25:50 +00:00
2014-08-01 11:48:33 +00:00
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
2014-07-03 11:25:50 +00:00
end
end