personal-journal/app/controllers/journal_papers_controller.rb

51 lines
1.9 KiB
Ruby

class JournalPapersController < ApplicationController
def index
journal_papers = JournalPaper.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
journal_paper_list = journal_papers.collect do |journal_paper|
{
"year" => journal_paper.year,
"paper_title" => journal_paper.create_link,
"author" => journal_paper.authors,
"link_to_show" => OrbitHelper.url_to_show(journal_paper.to_param)
}
end
{
"journal_papers" => journal_paper_list,
"extras" => {
"widget-title" => t("module_name.journal_paper"),
"th_year" => t('personal_plugins.year'),
"th_title" => t("personal_conference.paper_title"),
"th_author" => t('personal_plugins.author')
},
"total_pages" => journal_papers.total_pages
}
end
def show
params = OrbitHelper.params
plugin = JournalPaper.find_by(uid: params[:uid])
fields_to_show = [
"paper_title",
"journal_title",
"level_type",
"paper_type",
"authors",
"author_type",
"year",
"publication_date",
"language",
"vol_no",
"issue_no",
"form_to_start",
"form_to_end",
"total_pages",
"isbn",
"url",
"note",
"file"
]
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
end
end