Update personal_journals_controller.rb

This commit is contained in:
chiu 2019-11-02 11:38:56 +08:00
parent d5ae586a4b
commit c0a5af9280
1 changed files with 5 additions and 1 deletions

View File

@ -1,4 +1,5 @@
class PersonalJournalsController < ApplicationController class PersonalJournalsController < ApplicationController
include Admin::JournalPapersHelper
def index def index
params = OrbitHelper.params params = OrbitHelper.params
page_data_count = OrbitHelper.page_data_count page_data_count = OrbitHelper.page_data_count
@ -42,6 +43,8 @@ class PersonalJournalsController < ApplicationController
journal_papers_show = journal_papers_temp.select { |value| search_all_words((value.journal_paper_type.title rescue ''), params[:keywords]) } journal_papers_show = journal_papers_temp.select { |value| search_all_words((value.journal_paper_type.title rescue ''), params[:keywords]) }
when 'language' when 'language'
journal_papers_show = journal_papers_temp.select { |value| search_all_words((!value.language.nil? ? t(value.language.to_s) : ''), params[:keywords]) } journal_papers_show = journal_papers_temp.select { |value| search_all_words((!value.language.nil? ? t(value.language.to_s) : ''), params[:keywords]) }
when 'authors'
journal_papers_show = journal_papers_temp.select { |value| search_all_words(get_authors_text(value), params[:keywords]) }
else else
journal_papers_show = journal_papers_temp.select { |value| search_all_words(value.send(params[:selectbox]).to_s, params[:keywords]) } journal_papers_show = journal_papers_temp.select { |value| search_all_words(value.send(params[:selectbox]).to_s, params[:keywords]) }
end end
@ -74,6 +77,8 @@ class PersonalJournalsController < ApplicationController
t << { 'value' => (!journal_paper.language.nil? ? t(journal_paper.language.to_s) : '') } t << { 'value' => (!journal_paper.language.nil? ? t(journal_paper.language.to_s) : '') }
when 'url' when 'url'
t << { 'value' => ("<a href='#{journal_paper.url}'>#{journal_paper.url}</a>" rescue '')} t << { 'value' => ("<a href='#{journal_paper.url}'>#{journal_paper.url}</a>" rescue '')}
when 'authors'
t << { 'value' => get_authors_text(journal_paper) }
else else
t << { 'value' => (journal_paper.send(fs) rescue '') } t << { 'value' => (journal_paper.send(fs) rescue '') }
end end
@ -163,7 +168,6 @@ class PersonalJournalsController < ApplicationController
abstract abstract
language language
url url
author
] ]
@fields_to_show = @fields_to_show.map { |fs| [t("personal_journal.#{fs}"), fs] } @fields_to_show = @fields_to_show.map { |fs| [t("personal_journal.#{fs}"), fs] }
@default_fields_to_show = %w[ @default_fields_to_show = %w[