diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8685c3f..238a0fc 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -29,6 +29,7 @@ module ApplicationHelper
if site.sitemap_menu_in_header
sub_menu_html = sub_menu_html + "Sitemap"
end
+ sub_menu_html = sub_menu_html.nil? ? "" : sub_menu_html
html = html.gsub("{{header-data}}",sub_menu_html)
html.html_safe
end
@@ -44,6 +45,7 @@ module ApplicationHelper
if site.enable_terms_of_use
site_footer = site_footer + "Terms of use"
end
+ site_footer = site_footer.nil? ? "" : site_footer
html = html.gsub("{{footer-data}}",site_footer)
html.html_safe
end
diff --git a/app/views/layouts/_right_menu.html.erb b/app/views/layouts/_right_menu.html.erb
index fba5085..a4d33f7 100644
--- a/app/views/layouts/_right_menu.html.erb
+++ b/app/views/layouts/_right_menu.html.erb
@@ -1,12 +1,17 @@
+ <%
+ google_search_cx = current_site.search['sitesearch'] rescue nil
+ unless google_search_cx.blank?
+ %>
-
+ <% end %>
-
diff --git a/app/views/orbit_bar/index.html.erb b/app/views/orbit_bar/index.html.erb
index 312cd99..bdfe198 100644
--- a/app/views/orbit_bar/index.html.erb
+++ b/app/views/orbit_bar/index.html.erb
@@ -68,12 +68,17 @@
+ <%
+ google_search_cx = current_site.search['sitesearch'] rescue nil
+ unless google_search_cx.blank?
+ %>
-
+ <% end %>
-
<%= t(locale.to_s) %>
diff --git a/config/environment.rb b/config/environment.rb
index da7002b..15b6668 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -9,12 +9,13 @@ if Site.count == 0
site.title_translations = {:en=>"Orbit",:zh_tw=>"Orbit"}
site.valid_locales = [:en, :zh_tw]
site.in_use_locales = site.valid_locales
+ site.template = Dir.glob("#{Rails.root}/app/templates/*").last.split('/').last
site.save
end
if Site.first.template.nil?
site = Site.first
- site.template = Dir.glob("#{Rails.root}/app/templates/#{Template::KEY}").first.split("/").last
+ site.template = Dir.glob("#{Rails.root}/app/templates/*").last.split('/').last
site.save
end
@@ -51,6 +52,7 @@ if User.count==0
profile = MemberProfile.new
profile.first_name_translations = {:en=>'Digital', :zh_tw=>'Digital'}
profile.last_name_translations = {:en=>'Ruling', :zh_tw=>'Ruling'}
+ profile.email = "orbit@rulingcom.com"
profile.save
role.member_profiles << profile
@@ -62,4 +64,4 @@ if User.count==0
user.password = "bjo4xjp6"
user.email = "orbit@rulingcom.com"
user.save
-end
+end
\ No newline at end of file
diff --git a/config/initializers/template.rb b/config/initializers/template.rb
index 291d59e..2580bb0 100644
--- a/config/initializers/template.rb
+++ b/config/initializers/template.rb
@@ -1,4 +1,8 @@
-Dir.glob("#{Rails.root}/app/templates/#{Site.first.template}").each do |path|
+
+template = Site.first.template rescue nil
+template = template.nil? ? Dir.glob("#{Rails.root}/app/templates/*").last.split('/').last : template
+
+Dir.glob("#{Rails.root}/app/templates/#{template}").each do |path|
Rails.application.config.assets.paths << "#{path}/assets/stylesheets"
Rails.application.config.assets.paths << "#{path}/assets/javascripts"
Rails.application.config.assets.paths << "#{path}/assets/images"