forked from saurabh/personal-journal
Update personal_journals_controller.rb
This commit is contained in:
parent
dd492dfc9d
commit
f1e57a93ab
|
@ -21,10 +21,10 @@ class PersonalJournalsController < ApplicationController
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
if params[:selectbox] !=nil
|
if params[:selectbox] !=nil
|
||||||
t = Time.now
|
|
||||||
journal_papers = JournalPaper.where(:is_hidden=>false)
|
journal_papers = JournalPaper.where(:is_hidden=>false)
|
||||||
journal_papers_count = journal_papers.count
|
journal_papers_count = journal_papers.count
|
||||||
journal_papers_temp = journal_papers.take(journal_papers_count).sort_by{ |tp| [-tp[:year].to_i,-tp[:publication_date].to_i] }
|
journal_papers_temp = journal_papers.take(journal_papers_count).sort_by{ |tp| [-tp[:year].to_i,-tp[:publication_date].to_i] }
|
||||||
|
t = Time.now
|
||||||
case params[:selectbox]
|
case params[:selectbox]
|
||||||
when "paper_title","default"
|
when "paper_title","default"
|
||||||
if page.custom_string_field == "table"
|
if page.custom_string_field == "table"
|
||||||
|
@ -43,6 +43,7 @@ class PersonalJournalsController < ApplicationController
|
||||||
else
|
else
|
||||||
journal_papers_show = journal_papers_temp.select {|value| value.send(params[:selectbox]).to_s.upcase.include? params[:keywords].upcase}
|
journal_papers_show = journal_papers_temp.select {|value| value.send(params[:selectbox]).to_s.upcase.include? params[:keywords].upcase}
|
||||||
end
|
end
|
||||||
|
timer = Time.now-t
|
||||||
if params[:page_no].nil?
|
if params[:page_no].nil?
|
||||||
page_to_show = 1
|
page_to_show = 1
|
||||||
else
|
else
|
||||||
|
@ -50,7 +51,6 @@ class PersonalJournalsController < ApplicationController
|
||||||
end
|
end
|
||||||
journal_papers = journal_papers_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count]
|
journal_papers = journal_papers_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count]
|
||||||
journal_papers_total_pages = (journal_papers_show.length/OrbitHelper.page_data_count.to_f).ceil
|
journal_papers_total_pages = (journal_papers_show.length/OrbitHelper.page_data_count.to_f).ceil
|
||||||
timer = Time.now-t
|
|
||||||
else
|
else
|
||||||
journal_papers_total_pages = journal_papers.total_pages
|
journal_papers_total_pages = journal_papers.total_pages
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue