2014-07-04 07:18:31 +00:00
|
|
|
class PersonalResearchesController < ApplicationController
|
|
|
|
def index
|
2014-07-18 07:06:41 +00:00
|
|
|
researchs = Research.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
2014-07-04 07:18:31 +00:00
|
|
|
research_list = researchs.collect do |research|
|
|
|
|
{
|
2014-10-03 06:17:06 +00:00
|
|
|
"member" => (research.member_profile.name rescue ""),
|
2014-07-04 07:18:31 +00:00
|
|
|
"year" => research.year,
|
2014-07-18 07:06:41 +00:00
|
|
|
"publication_date" => (research.publish_date.strftime("%Y.%m") rescue ""),
|
2014-07-04 07:18:31 +00:00
|
|
|
"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')
|
2014-07-18 07:06:41 +00:00
|
|
|
},
|
|
|
|
"total_pages" => researchs.total_pages
|
2014-07-04 07:18:31 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
params = OrbitHelper.params
|
2014-08-01 11:49:35 +00:00
|
|
|
plugin = Research.where(:is_hidden=>false).find_by(uid: params[:uid])
|
|
|
|
fields_to_show =[
|
2015-01-09 07:46:18 +00:00
|
|
|
"year",
|
2015-12-30 10:12:32 +00:00
|
|
|
"research_category",
|
2015-01-09 07:46:18 +00:00
|
|
|
"publish_date",
|
2014-08-01 11:49:35 +00:00
|
|
|
"research_title",
|
|
|
|
"authors",
|
|
|
|
"extracted_chapters",
|
|
|
|
"language",
|
|
|
|
"keywords",
|
|
|
|
"url",
|
|
|
|
"note",
|
|
|
|
"file"
|
|
|
|
]
|
2014-07-04 07:18:31 +00:00
|
|
|
|
2014-08-01 11:49:35 +00:00
|
|
|
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
|
|
|
|
|
|
|
# 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
|
2014-07-04 07:18:31 +00:00
|
|
|
|
2014-08-01 11:49:35 +00:00
|
|
|
# {
|
|
|
|
# "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") rescue ""),
|
|
|
|
# "keywords" => research.keywords,
|
|
|
|
# "url" => research.url,
|
|
|
|
# "note" => research.note,
|
2014-07-04 07:18:31 +00:00
|
|
|
|
2014-08-01 11:49:35 +00:00
|
|
|
# "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_)
|
|
|
|
# }
|
|
|
|
# }
|
2014-07-04 07:18:31 +00:00
|
|
|
end
|
|
|
|
end
|