Update personal_journals_controller.rb
This commit is contained in:
parent
36c3439185
commit
dbea87909c
|
@ -23,15 +23,21 @@ class PersonalJournalsController < ApplicationController
|
|||
if params[:selectbox] !=nil
|
||||
journal_papers = Mongoid::Sessions.default[:journal_papers].find()
|
||||
journal_papers_count = journal_papers.count
|
||||
journal_papers_temp = Mongoid::Sessions.default[:journal_papers].find().take(journal_papers_count)
|
||||
journal_papers_show = journal_papers_temp.select {|value| value[params[:selectbox]][OrbitHelper.params[:locale]].include? params[:keywords]}
|
||||
journal_papers_temp = Mongoid::Sessions.default[:journal_papers].find().take(journal_papers_count).sort_by{ |tp| [-tp[:year].to_i,-tp[:publication_date].to_i] }
|
||||
journal_papers_show = journal_papers_temp.select {|value| value[params[:selectbox]][params[:locale]].include? params[:keywords]}
|
||||
if params[:page_no].nil?
|
||||
page_to_show = 1
|
||||
else
|
||||
page_to_show = params[:page_no].to_i
|
||||
end
|
||||
journal_papers_show_last = journal_papers_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count]
|
||||
{
|
||||
"journal_papers" => [{"jps"=>[{"value"=>"2019"}, {"value"=>"123, 456"}]}],
|
||||
"headers" => [{"head-title"=>"年度", "col"=>2}, {"head-title"=>"論文名稱", "col"=>3}],
|
||||
"extras" => {"widget-title" => "module_name.journal_paper"},
|
||||
"total_pages" => 1,
|
||||
"choice" => 1,
|
||||
"all" => OrbitHelper.page_data_count
|
||||
"all" => journal_papers_show_last
|
||||
}
|
||||
else
|
||||
journal_paper_list = []
|
||||
|
|
Loading…
Reference in New Issue