Update personal_books_controller.rb

This commit is contained in:
chiu 2019-08-14 15:29:35 +08:00
parent 3204aa0b7d
commit 44ed0018a8
1 changed files with 3 additions and 3 deletions

View File

@ -37,7 +37,7 @@ class PersonalBooksController < ApplicationController
when "author_type"
books_show = books_temp.select {|value| value.book_author_types.collect{|bat| bat.title}.join(", ").include? params[:keywords]}
when "language"
books_show = books_temp.select {|value| (!value.language.nil? ? I18n.t("personal_book.#{value.language}") : "").include? params[:keywords]}
books_show = books_temp.select {|value| (!value.language.nil? ? t("#{value.language}") : "").include? params[:keywords]}
else
books_show = books_temp.select {|value| value.send(params[:selectbox]).to_s.include? params[:keywords]}
end
@ -64,11 +64,11 @@ class PersonalBooksController < ApplicationController
t << {"value" => "<a href='#{OrbitHelper.url_to_show(book.to_param)}'>#{book.create_link}</a>"}
end
when "publish_date", "publication_date"
t << {"value" => "book.publication_date.strftime('%Y/%m/%d')"}
t << {"value" => (!book.publication_date.nil? ? book.publication_date.strftime('%Y/%m/%d') : "")}
when "author_type"
t << {"value" => (book.book_author_types.collect{|bat| bat.title}.join(", ") rescue "")}
when "language"
t << {"value" => (!book.language.nil? ? t("#{book.language}") : "" rescue "")}
t << {"value" => (!book.language.nil? ? t("#{book.language}") : "")}
else
t << {"value" => book.send(fs)}
end