2014-07-04 06:14:37 +00:00
|
|
|
class PersonalProjectsController < ApplicationController
|
|
|
|
def index
|
2014-08-01 11:49:10 +00:00
|
|
|
projects = Project.where(:is_hidden=>false).order_by(:period_start_date=>'desc',:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
2014-07-04 06:14:37 +00:00
|
|
|
project_list = projects.collect do |project|
|
|
|
|
{
|
2015-01-09 07:40:06 +00:00
|
|
|
"year" => project.year,
|
2014-07-04 06:14:37 +00:00
|
|
|
"duration" => project.duration,
|
|
|
|
"project_title" => project.project_title,
|
|
|
|
"job_title" => project.job_title,
|
|
|
|
"participator" => project.participator,
|
2015-01-09 07:40:06 +00:00
|
|
|
"unit" => project.unit,
|
2014-10-03 06:13:52 +00:00
|
|
|
"authors" => (project.member_profile.name rescue ""),
|
2014-07-04 06:14:37 +00:00
|
|
|
"link_to_show" => OrbitHelper.url_to_show(project.to_param)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
{
|
|
|
|
"projects" => project_list,
|
|
|
|
"extras" => {
|
|
|
|
"widget-title" => t("module_name.personal_project"),
|
2015-01-09 07:40:06 +00:00
|
|
|
"th_year" => t('personal_project.year'),
|
2014-07-04 06:14:37 +00:00
|
|
|
"th_duration" => t('personal_project.period'),
|
|
|
|
"th_project_title" => t("personal_project.project_title"),
|
|
|
|
"th_job_title" => t('personal_project.job_title'),
|
|
|
|
"th_participator" => t("personal_project.participator"),
|
2015-01-09 07:40:06 +00:00
|
|
|
"th_unit" => t("personal_project.unit"),
|
2014-07-04 06:14:37 +00:00
|
|
|
"th_authors" => t('users.name')
|
2014-07-18 07:06:04 +00:00
|
|
|
},
|
|
|
|
"total_pages" => projects.total_pages
|
2014-07-04 06:14:37 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
params = OrbitHelper.params
|
2014-08-01 11:49:10 +00:00
|
|
|
plugin = Project.where(:is_hidden=>false).find_by(uid: params[:uid])
|
|
|
|
fields_to_show = [
|
2015-01-09 07:40:06 +00:00
|
|
|
"year",
|
2014-08-01 11:49:10 +00:00
|
|
|
"project_type",
|
2015-01-09 07:40:06 +00:00
|
|
|
"project_title",
|
2014-08-01 11:49:10 +00:00
|
|
|
"participator",
|
2015-01-09 07:40:06 +00:00
|
|
|
"job_title",
|
|
|
|
"period",
|
2014-08-01 11:49:10 +00:00
|
|
|
"unit",
|
|
|
|
"abstract",
|
|
|
|
"url",
|
2015-01-09 07:40:06 +00:00
|
|
|
"file",
|
|
|
|
"language",
|
2014-08-01 11:49:10 +00:00
|
|
|
]
|
2014-07-04 06:14:37 +00:00
|
|
|
|
2014-08-01 11:49:10 +00:00
|
|
|
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
2014-07-04 06:14:37 +00:00
|
|
|
|
2014-08-01 11:49:10 +00:00
|
|
|
# files = project.project_files.map do |file|
|
|
|
|
# {
|
|
|
|
# "file_url" => file.file.url,
|
|
|
|
# "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title),
|
|
|
|
# "file_ext" => File.extname(file.file.path).sub('.',''),
|
|
|
|
# "file_description" => file.description
|
|
|
|
# }
|
|
|
|
# end
|
2014-07-04 06:14:37 +00:00
|
|
|
|
2014-08-01 11:49:10 +00:00
|
|
|
# {
|
|
|
|
# "files" => files,
|
2014-07-04 06:14:37 +00:00
|
|
|
|
2014-08-01 11:49:10 +00:00
|
|
|
# "data" => {
|
|
|
|
# "project_title" => project.project_title,
|
|
|
|
# "project_type" => project.project_type.title,
|
|
|
|
# "job_title" => project.job_title,
|
|
|
|
# "participator" => project.participator,
|
|
|
|
# "unit" => project.unit,
|
|
|
|
# "year" => project.year,
|
|
|
|
# "language" => project.language,
|
|
|
|
# "keywords" => project.keywords,
|
|
|
|
# "abstract" => project.abstract,
|
|
|
|
# "duration" => project.duration,
|
|
|
|
# "url" => project.url,
|
|
|
|
# "note" => project.note,
|
2014-07-04 06:14:37 +00:00
|
|
|
|
2014-08-01 11:49:10 +00:00
|
|
|
# "th_project_title" => t("personal_project.project_title"),
|
|
|
|
# "th_job_title" => t("personal_project.job_title"),
|
|
|
|
# "th_participator" => t("personal_project.participator"),
|
|
|
|
# "th_unit" => t("personal_project.unit"),
|
|
|
|
# "th_year" => t("personal_project.year"),
|
|
|
|
# "th_language" => t("personal_project.language"),
|
|
|
|
# "th_keywords" => t("personal_project.keywords"),
|
|
|
|
# "th_abstract" => t("personal_project.abstract"),
|
|
|
|
# "th_duration" => t("personal_project.period"),
|
|
|
|
# "th_url" => t("personal_project.url"),
|
|
|
|
# "th_note" => t("personal_project.note"),
|
|
|
|
|
|
|
|
# "th_project_type" => t("personal_project.project_category"),
|
|
|
|
# "th_files" => t(:file_)
|
|
|
|
# }
|
|
|
|
# }
|
2014-07-04 06:14:37 +00:00
|
|
|
end
|
|
|
|
end
|