From 97b4eee7986fd4a7b4f701db4fd9d7f529b60bff Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 25 Jul 2012 17:20:25 +0800 Subject: [PATCH] full site search with google --- app/models/site.rb | 2 ++ app/views/admin/sites/site_info.html.erb | 9 +++++++++ app/views/layouts/_orbit_bar.html.erb | 10 ++++++++-- app/views/shared/_search_not_found.html.erb | 1 + config/locales/en.yml | 6 +++++- config/locales/zh_tw.yml | 5 ++++- 6 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 app/views/shared/_search_not_found.html.erb diff --git a/app/models/site.rb b/app/models/site.rb index 55d6bfaf..4bd4e19f 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -18,6 +18,8 @@ class Site field :school field :department + field :search,:type => Hash + has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :sub_menu, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy diff --git a/app/views/admin/sites/site_info.html.erb b/app/views/admin/sites/site_info.html.erb index e19307ca..021522fb 100644 --- a/app/views/admin/sites/site_info.html.erb +++ b/app/views/admin/sites/site_info.html.erb @@ -33,6 +33,15 @@ <% end %> <% end %> +
+ +
+ <%= text_field_tag 'site[search][domains]',@site.search["domains"], {:class => "input-xxlarge" ,:placeholder => t("search.domains") }%> + <%= text_field_tag 'site[search][sitesearch]',@site.search["sitesearch"],{ :class => "input-xxlarge" ,:placeholder => t("search.sitesearch") }%> +

<%= (t 'search.site_setting_help').html_safe %>

+
+
+ <% @site_valid_locales.each do |locale|%> <%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
diff --git a/app/views/layouts/_orbit_bar.html.erb b/app/views/layouts/_orbit_bar.html.erb index 4b74ab28..252fc91e 100644 --- a/app/views/layouts/_orbit_bar.html.erb +++ b/app/views/layouts/_orbit_bar.html.erb @@ -34,8 +34,14 @@ <% if user_signed_in? %> diff --git a/app/views/shared/_search_not_found.html.erb b/app/views/shared/_search_not_found.html.erb new file mode 100644 index 00000000..43d8c7dd --- /dev/null +++ b/app/views/shared/_search_not_found.html.erb @@ -0,0 +1 @@ + <%= t("search.not_found") %> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 5cb5706a..3966c893 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -294,4 +294,8 @@ en: limit_of_upload_file_size: "Upload file must be less than: %{best_size}" search: - not_found: "NOT FOUND" \ No newline at end of file + not_found: "NOT FOUND" + domains: Google Search Domains + site_search: Site Search + sitesearch: Google Site Search + site_setting_help: Please Enter the search argument for Google search. \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 53ab04cf..c06bdf07 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -432,7 +432,10 @@ zh_tw: search: not_found: "沒有搜尋結果" - + domains: Google Search Domains + site_search: "全站搜尋" + sitesearch: Google Site Search + site_setting_help: 請輸入送交Google搜尋的參數 activerecord: errors: template: # ~ 2.3.5 backward compatible