forked from saurabh/personal-journal
Update personal_journals_controller.rb
This commit is contained in:
parent
52e655ba7f
commit
1bbca25a7e
|
@ -20,30 +20,35 @@ class PersonalJournalsController < ApplicationController
|
||||||
"paper_title"
|
"paper_title"
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
journal_paper_list = []
|
if params.selectbox != nil
|
||||||
journal_papers.each do |journal_paper|
|
journal_papers = Mongoid::Sessions.default[:journal_papers].find()
|
||||||
t = []
|
journal_papers_count = journal_papers.count
|
||||||
fields_to_show.each do |fs|
|
journal_papers_temp = Mongoid::Sessions.default[:journal_papers].find().take(journal_papers_count)
|
||||||
case fs
|
else
|
||||||
when "paper_title"
|
journal_paper_list = []
|
||||||
if page.custom_string_field == "table"
|
journal_papers.each do |journal_paper|
|
||||||
t << {"value" => "<a href='#{OrbitHelper.url_to_show(journal_paper.to_param)}'>#{journal_paper.paper_title}</a>"}
|
t = []
|
||||||
else
|
fields_to_show.each do |fs|
|
||||||
t << {"value" => "<a href='#{OrbitHelper.url_to_show(journal_paper.to_param)}'>#{journal_paper.create_link}</a>"}
|
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
|
end
|
||||||
when "level_type"
|
journal_paper_list << {"jps" => t}
|
||||||
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
|
||||||
end
|
|
||||||
journal_paper_list << {"jps" => t}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
headers = []
|
headers = []
|
||||||
choice_show = []
|
choice_show = []
|
||||||
fields_to_show.each do |fs|
|
fields_to_show.each do |fs|
|
||||||
|
@ -66,7 +71,7 @@ class PersonalJournalsController < ApplicationController
|
||||||
"total_pages" => journal_papers.total_pages,
|
"total_pages" => journal_papers.total_pages,
|
||||||
"choice" => {"choice_value" => choice_value ,"choice_show" => choice_show},
|
"choice" => {"choice_value" => choice_value ,"choice_show" => choice_show},
|
||||||
"url" => "/"+OrbitHelper.params[:locale]+OrbitHelper.params[:url],
|
"url" => "/"+OrbitHelper.params[:locale]+OrbitHelper.params[:url],
|
||||||
"all" => journal_papers.all.take(journal_papers.all.count)
|
"all" => journal_papers_temp
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue