Update personal_conferences_controller.rb
This commit is contained in:
parent
fbf6433036
commit
609a1c83ba
|
@ -1,4 +1,9 @@
|
|||
class PersonalConferencesController < ApplicationController
|
||||
def search_all_words(target,word)
|
||||
target=target.upcase
|
||||
words=word.upcase.split(' ')
|
||||
return words.select{|value| target.include? value}==words
|
||||
end
|
||||
def index
|
||||
params = OrbitHelper.params
|
||||
writing_conferences = WritingConference.where(:is_hidden=>false).sort_for_frontend.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
|
@ -26,24 +31,24 @@ class PersonalConferencesController < ApplicationController
|
|||
case params[:selectbox]
|
||||
when "paper_title","default"
|
||||
if page.custom_string_field == "table"
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| value.paper_title.include? params[:keywords]}
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.paper_title, params[:keywords])}
|
||||
else
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| value.create_link.include? params[:keywords]}
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.create_link, params[:keywords])}
|
||||
end
|
||||
when "paper_levels"
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| value.conference_paper_levels.collect{|x| x.title}.join(', ').to_s.include? params[:keywords]}
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.conference_paper_levels.collect{|x| x.title}.join(', ').to_s, params[:keywords])}
|
||||
when "paper_types"
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| value.conference_paper_types.collect{|x| x.title}.join(', ').to_s.include? params[:keywords]}
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.conference_paper_types.collect{|x| x.title}.join(', ').to_s, params[:keywords])}
|
||||
when "period"
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| value.duration.include? params[:keywords]}
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.duration.include? params[:keywords]}
|
||||
when "publication_date"
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| value.send("publication_date").strftime("%Y/%m").collect{|x| x.title}.join(', ').include? params[:keywords]}
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.send("publication_date").strftime("%Y/%m").collect{|x| x.title}.join(', '), params[:keywords])}
|
||||
when "author_type"
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| value.conference_author_types.collect{|cat| cat.title}.join(", ").include? params[:keywords]}
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.conference_author_types.collect{|cat| cat.title}.join(", "), params[:keywords])}
|
||||
when "language"
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| (!value.language.nil? ? t("#{value.language}") : "").include? params[:keywords]}
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| search_all_words((!value.language.nil? ? t("#{value.language}") : ""), params[:keywords])}
|
||||
else
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| value.send(params[:selectbox]).to_s.include? params[:keywords]}
|
||||
writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.send(params[:selectbox]).to_s, params[:keywords])}
|
||||
end
|
||||
if params[:page_no].nil?
|
||||
page_to_show = 1
|
||||
|
|
Loading…
Reference in New Issue