personal-journal/app/controllers/journal_papers_controller.rb

53 lines
2.0 KiB
Ruby
Raw Normal View History

class JournalPapersController < ApplicationController
def index
2014-08-01 10:56:56 +00:00
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|
{
2014-07-18 07:04:07 +00:00
"year" => journal_paper.year,
2014-08-01 10:56:56 +00:00
"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" => {
2014-07-18 07:04:07 +00:00
"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
2014-08-01 10:56:56 +00:00
}
end
def show
2014-08-01 04:23:53 +00:00
params = OrbitHelper.params
2014-08-01 10:56:56 +00:00
plugin = JournalPaper.find_by(uid: params[:uid])
fields_to_show = [
"paper_title",
"journal_title",
"level_type",
"paper_type",
2014-08-11 11:16:52 +00:00
"author_name",
2014-08-01 10:56:56 +00:00
"authors",
"author_type",
"year",
"publication_date",
"language",
"vol_no",
"issue_no",
"form_to_start",
"form_to_end",
"total_pages",
"isbn",
"url",
2014-08-11 11:16:52 +00:00
"associated_project",
2014-08-01 10:56:56 +00:00
"note",
"file"
]
2014-08-01 04:23:53 +00:00
2014-08-01 10:56:56 +00:00
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
end
end