65 lines
2.3 KiB
Ruby
65 lines
2.3 KiB
Ruby
class PersonalResearchesController < ApplicationController
|
|
def index
|
|
researchs = Research.where(:is_hidden=>false).all
|
|
research_list = researchs.collect do |research|
|
|
{
|
|
"member" => research.member_profile.name,
|
|
"year" => research.year,
|
|
"publication_date" => research.publish_date.strftime("%Y.%m"),
|
|
"research_title" => research.research_title,
|
|
"link_to_show" => OrbitHelper.url_to_show(research.to_param)
|
|
}
|
|
end
|
|
{
|
|
"researchs" => research_list,
|
|
"extras" => {
|
|
"widget-title" => t("module_name.personal_research"),
|
|
"th_member" => t('users.name'),
|
|
"th_year" => t('personal_research.year'),
|
|
"th_publication_date" => t('personal_research.publication_date'),
|
|
"th_research_title" => t('personal_research.research_title'),
|
|
"th_detail" => t('detail')
|
|
}
|
|
}
|
|
end
|
|
|
|
def show
|
|
params = OrbitHelper.params
|
|
research = Research.where(:is_hidden=>false).find_by(uid: params[:uid])
|
|
|
|
files = research.research_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
|
|
|
|
{
|
|
"files" => files,
|
|
"data" => {
|
|
"research_title" => research.research_title,
|
|
"authors" => research.authors,
|
|
"extracted_chapters" => research.extracted_chapters,
|
|
"year" => research.year,
|
|
"language" => t(research.language),
|
|
"publish_date" => research.publish_date.strftime("%Y.%m"),
|
|
"keywords" => research.keywords,
|
|
"url" => research.url,
|
|
"note" => research.note,
|
|
|
|
"th_research_title" => t("personal_research.research_title"),
|
|
"th_authors" => t("personal_research.authors"),
|
|
"th_extracted_chapters" => t("personal_research.extracted_chapters"),
|
|
"th_year" => t("personal_research.year"),
|
|
"th_language" => t("personal_research.language"),
|
|
"th_publish_date" => t("personal_research.publication_date"),
|
|
"th_keywords" => t("personal_research.keywords"),
|
|
"th_url" => t("personal_research.url"),
|
|
"th_note" => t("personal_research.note"),
|
|
"th_files" => t(:file_)
|
|
}
|
|
}
|
|
end
|
|
end |