Update personal_journals_controller.rb

This commit is contained in:
chiu 2019-08-14 10:48:31 +08:00
parent 1295cb50e9
commit 60a4dd1743
1 changed files with 6 additions and 5 deletions

View File

@ -25,7 +25,7 @@ class PersonalJournalsController < ApplicationController
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] }
case params[:selectbox]
when "paper_title"
when "paper_title","default"
if page.custom_string_field == "table"
journal_papers_show = journal_papers_temp.select {|value| value.paper_title.include? params[:keywords]}
else
@ -86,13 +86,14 @@ class PersonalJournalsController < ApplicationController
choice_show << t("personal_journal.#{fs}")
end
choice_value = fields_to_show
choice_value.unshift("paper_title")
choice_value.unshift("default")
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_select=choice_value.map{|iter| iter==params[:selectbox] ? "true" : "false"}
choice_show=choice_show.map{|value| {"choice_show" => value}}
choice=choice_value.zip(choice_show)
choice=choice.map{|value| value[0].merge(value[1])}
choice=choice_value.zip(choice_show,choice_select)
choice=choice.map{|value| value.inject:merge}
select_text = params[:locale]!='en' ? "搜尋類別:" : "search class:"
search_text = params[:locale]!='en' ? "關鍵字搜尋:" : "word to search:"
{