From 60a4dd174377e554069bd495c2e55a17c6eacae1 Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 14 Aug 2019 10:48:31 +0800 Subject: [PATCH] Update personal_journals_controller.rb --- app/controllers/personal_journals_controller.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 8e74986..8ac6941 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -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:" {