parent
05a285a472
commit
1e55555f84
|
@ -1,12 +1,8 @@
|
|||
class PersonalProjectsController < 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
|
||||
projects = Project.where(:project_title.ne => nil,:project_title.ne => "").sort_for_frontend.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
page_data_count = OrbitHelper.page_data_count
|
||||
projects = Project.where(:project_title.ne => nil,:project_title.ne => "").sort_for_frontend.page(OrbitHelper.params[:page_no]).per(page_data_count)
|
||||
fields_to_show = Page.where(:page_id => params[:page_id]).first.custom_array_field rescue []
|
||||
if fields_to_show.blank?
|
||||
fields_to_show = [
|
||||
|
@ -38,8 +34,8 @@ class PersonalProjectsController < ApplicationController
|
|||
else
|
||||
page_to_show = params[:page_no].to_i
|
||||
end
|
||||
projects = projects_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count]
|
||||
projects_total_pages = (projects_show.length/OrbitHelper.page_data_count.to_f).ceil
|
||||
projects = projects_show[(page_to_show-1)*page_data_count...page_to_show*page_data_count]
|
||||
projects_total_pages = (projects_show.length/page_data_count.to_f).ceil
|
||||
else
|
||||
projects_total_pages = projects.total_pages
|
||||
end
|
||||
|
@ -78,13 +74,13 @@ class PersonalProjectsController < ApplicationController
|
|||
choice_select=choice_value.map{|iter| iter==params[:selectbox] ? "selected" : ""}
|
||||
choice_select=choice_select.map{|value| {"choice_select" => value}}
|
||||
choice_value=choice_value.map{|value| {"choice_value" => value}}
|
||||
choice_default = params[:locale]!='en' ? "——選取分類——" : "——select class——"
|
||||
choice_default = t("personal_project.select_class")
|
||||
choice_show.unshift(choice_default)
|
||||
choice_show=choice_show.map{|value| {"choice_show" => value}}
|
||||
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:"
|
||||
select_text = t("personal_project.search_class")
|
||||
search_text = t("personal_project.word_to_search")
|
||||
{
|
||||
"projects" => project_list,
|
||||
"headers" => headers,
|
||||
|
@ -152,6 +148,11 @@ class PersonalProjectsController < ApplicationController
|
|||
page.save
|
||||
render :json => {"success" => true}.to_json
|
||||
end
|
||||
|
||||
private
|
||||
def search_all_words(target,word)
|
||||
target=target.upcase
|
||||
words=word.upcase.split(' ')
|
||||
return words.select{|value| target.include? value}==words
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue