forked from saurabh/personal-journal
Update personal_journals_controller.rb
This commit is contained in:
parent
1295cb50e9
commit
60a4dd1743
|
@ -25,7 +25,7 @@ class PersonalJournalsController < ApplicationController
|
||||||
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] }
|
||||||
case params[:selectbox]
|
case params[:selectbox]
|
||||||
when "paper_title"
|
when "paper_title","default"
|
||||||
if page.custom_string_field == "table"
|
if page.custom_string_field == "table"
|
||||||
journal_papers_show = journal_papers_temp.select {|value| value.paper_title.include? params[:keywords]}
|
journal_papers_show = journal_papers_temp.select {|value| value.paper_title.include? params[:keywords]}
|
||||||
else
|
else
|
||||||
|
@ -86,13 +86,14 @@ class PersonalJournalsController < ApplicationController
|
||||||
choice_show << t("personal_journal.#{fs}")
|
choice_show << t("personal_journal.#{fs}")
|
||||||
end
|
end
|
||||||
choice_value = fields_to_show
|
choice_value = fields_to_show
|
||||||
choice_value.unshift("paper_title")
|
choice_value.unshift("default")
|
||||||
choice_value=choice_value.map{|value| {"choice_value" => value}}
|
choice_value=choice_value.map{|value| {"choice_value" => value}}
|
||||||
choice_default = OrbitHelper.params[:locale]!='en' ? "——選取分類——" : "——select class——"
|
choice_default = params[:locale]!='en' ? "——選取分類——" : "——select class——"
|
||||||
choice_show.unshift(choice_default)
|
choice_show.unshift(choice_default)
|
||||||
|
choice_select=choice_value.map{|iter| iter==params[:selectbox] ? "true" : "false"}
|
||||||
choice_show=choice_show.map{|value| {"choice_show" => value}}
|
choice_show=choice_show.map{|value| {"choice_show" => value}}
|
||||||
choice=choice_value.zip(choice_show)
|
choice=choice_value.zip(choice_show,choice_select)
|
||||||
choice=choice.map{|value| value[0].merge(value[1])}
|
choice=choice.map{|value| value.inject:merge}
|
||||||
select_text = params[:locale]!='en' ? "搜尋類別:" : "search class:"
|
select_text = params[:locale]!='en' ? "搜尋類別:" : "search class:"
|
||||||
search_text = params[:locale]!='en' ? "關鍵字搜尋:" : "word to search:"
|
search_text = params[:locale]!='en' ? "關鍵字搜尋:" : "word to search:"
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue