parent
3e85585152
commit
00103841c3
|
@ -1,12 +1,8 @@
|
||||||
class PersonalPatentsController < ApplicationController
|
class PersonalPatentsController < 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
|
def index
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
patents = Patent.where(:is_hidden=>false).sort_for_frontend.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
page_data_count = OrbitHelper.page_data_count
|
||||||
|
patents = Patent.where(:is_hidden=>false).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 []
|
fields_to_show = Page.where(:page_id => params[:page_id]).first.custom_array_field rescue []
|
||||||
if fields_to_show.blank?
|
if fields_to_show.blank?
|
||||||
fields_to_show = [
|
fields_to_show = [
|
||||||
|
@ -38,8 +34,8 @@ class PersonalPatentsController < ApplicationController
|
||||||
else
|
else
|
||||||
page_to_show = params[:page_no].to_i
|
page_to_show = params[:page_no].to_i
|
||||||
end
|
end
|
||||||
patents = patents_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count]
|
patents = patents_show[(page_to_show-1)*page_data_count...page_to_show*page_data_count]
|
||||||
patents_total_pages = (patents_show.length/OrbitHelper.page_data_count.to_f).ceil
|
patents_total_pages = (patents_show.length/page_data_count.to_f).ceil
|
||||||
else
|
else
|
||||||
patents_total_pages = patents.total_pages
|
patents_total_pages = patents.total_pages
|
||||||
end
|
end
|
||||||
|
@ -85,13 +81,13 @@ class PersonalPatentsController < ApplicationController
|
||||||
choice_select=choice_value.map{|iter| iter==params[:selectbox] ? "selected" : ""}
|
choice_select=choice_value.map{|iter| iter==params[:selectbox] ? "selected" : ""}
|
||||||
choice_select=choice_select.map{|value| {"choice_select" => value}}
|
choice_select=choice_select.map{|value| {"choice_select" => value}}
|
||||||
choice_value=choice_value.map{|value| {"choice_value" => value}}
|
choice_value=choice_value.map{|value| {"choice_value" => value}}
|
||||||
choice_default = params[:locale]!='en' ? "——選取分類——" : "——select class——"
|
choice_default = t("personal_patent.select_class")
|
||||||
choice_show.unshift(choice_default)
|
choice_show.unshift(choice_default)
|
||||||
choice_show=choice_show.map{|value| {"choice_show" => value}}
|
choice_show=choice_show.map{|value| {"choice_show" => value}}
|
||||||
choice=choice_value.zip(choice_show,choice_select)
|
choice=choice_value.zip(choice_show,choice_select)
|
||||||
choice=choice.map{|value| value.inject:merge}
|
choice=choice.map{|value| value.inject:merge}
|
||||||
select_text = params[:locale]!='en' ? "搜尋類別:" : "search class:"
|
select_text = t("personal_patent.search_class")
|
||||||
search_text = params[:locale]!='en' ? "關鍵字搜尋:" : "word to search:"
|
search_text = t("personal_patent.word_to_search")
|
||||||
{
|
{
|
||||||
"patents" => patent_list,
|
"patents" => patent_list,
|
||||||
"extras" => { "widget-title" => t("module_name.personal_patent"),
|
"extras" => { "widget-title" => t("module_name.personal_patent"),
|
||||||
|
@ -170,4 +166,10 @@ class PersonalPatentsController < ApplicationController
|
||||||
page.save
|
page.save
|
||||||
render :json => {"success" => true}.to_json
|
render :json => {"success" => true}.to_json
|
||||||
end
|
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
|
end
|
Loading…
Reference in New Issue