Update personal_journals_controller.rb
This commit is contained in:
parent
52e655ba7f
commit
1bbca25a7e
|
@ -20,30 +20,35 @@ class PersonalJournalsController < ApplicationController
|
|||
"paper_title"
|
||||
]
|
||||
end
|
||||
journal_paper_list = []
|
||||
journal_papers.each do |journal_paper|
|
||||
t = []
|
||||
fields_to_show.each do |fs|
|
||||
case fs
|
||||
when "paper_title"
|
||||
if page.custom_string_field == "table"
|
||||
t << {"value" => "<a href='#{OrbitHelper.url_to_show(journal_paper.to_param)}'>#{journal_paper.paper_title}</a>"}
|
||||
else
|
||||
t << {"value" => "<a href='#{OrbitHelper.url_to_show(journal_paper.to_param)}'>#{journal_paper.create_link}</a>"}
|
||||
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)
|
||||
else
|
||||
journal_paper_list = []
|
||||
journal_papers.each do |journal_paper|
|
||||
t = []
|
||||
fields_to_show.each do |fs|
|
||||
case fs
|
||||
when "paper_title"
|
||||
if page.custom_string_field == "table"
|
||||
t << {"value" => "<a href='#{OrbitHelper.url_to_show(journal_paper.to_param)}'>#{journal_paper.paper_title}</a>"}
|
||||
else
|
||||
t << {"value" => "<a href='#{OrbitHelper.url_to_show(journal_paper.to_param)}'>#{journal_paper.create_link}</a>"}
|
||||
end
|
||||
when "level_type"
|
||||
t << {"value" => ( !journal_paper.journal_levels.blank? ? "(#{journal_paper.journal_levels.collect{|x| x.title}.join(', ')})" : nil)}
|
||||
when "publication_date"
|
||||
t << {"value" => (journal_paper.send(fs).strftime("%Y/%m") rescue "")}
|
||||
when "author_type"
|
||||
t << {"value" => (journal_paper.journal_paper_author_types.collect{|jat| jat.title}.join(", ") rescue "")}
|
||||
else
|
||||
t << {"value" => journal_paper.send(fs)}
|
||||
end
|
||||
end
|
||||
when "level_type"
|
||||
t << {"value" => ( !journal_paper.journal_levels.blank? ? "(#{journal_paper.journal_levels.collect{|x| x.title}.join(', ')})" : nil)}
|
||||
when "publication_date"
|
||||
t << {"value" => (journal_paper.send(fs).strftime("%Y/%m") rescue "")}
|
||||
when "author_type"
|
||||
t << {"value" => (journal_paper.journal_paper_author_types.collect{|jat| jat.title}.join(", ") rescue "")}
|
||||
else
|
||||
t << {"value" => journal_paper.send(fs)}
|
||||
journal_paper_list << {"jps" => t}
|
||||
end
|
||||
end
|
||||
journal_paper_list << {"jps" => t}
|
||||
end
|
||||
|
||||
headers = []
|
||||
choice_show = []
|
||||
fields_to_show.each do |fs|
|
||||
|
@ -66,7 +71,7 @@ class PersonalJournalsController < ApplicationController
|
|||
"total_pages" => journal_papers.total_pages,
|
||||
"choice" => {"choice_value" => choice_value ,"choice_show" => choice_show},
|
||||
"url" => "/"+OrbitHelper.params[:locale]+OrbitHelper.params[:url],
|
||||
"all" => journal_papers.all.take(journal_papers.all.count)
|
||||
"all" => journal_papers_temp
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue