Update sit initialize

This commit is contained in:
manson 2014-05-26 12:57:47 +08:00
parent fcb1907230
commit f6adbaa4e0
5 changed files with 23 additions and 5 deletions

View File

@ -29,6 +29,7 @@ module ApplicationHelper
if site.sitemap_menu_in_header
sub_menu_html = sub_menu_html + "<a href='/#{I18n.locale.to_s}#{site.site_map_link}'>Sitemap</a>"
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 + "<a href='/#{I18n.locale.to_s}#{site.terms_of_use_link}'>Terms of use</a>"
end
site_footer = site_footer.nil? ? "" : site_footer
html = html.gsub("{{footer-data}}",site_footer)
html.html_safe
end

View File

@ -1,12 +1,17 @@
<ul class="nav pull-right" role="navigation">
<!-- search -->
<%
google_search_cx = current_site.search['sitesearch'] rescue nil
unless google_search_cx.blank?
%>
<li id="search" class="searchClear">
<form id="search_form" method="get" action="http://www.google.com/cse" target="_blank">
<input type="hidden" name="cx" value="<%= current_site.search['sitesearch'] rescue "" %>">
<input type="hidden" name="cx" value="<%= google_search_cx %>">
<%= text_field_tag 'q', '', {:class => "search-query input-medium", :placeholder => t("search.sitesearch"), 'x-webkit-speech' => ''} %>
</form>
</li>
<% end %>
<!-- Language -->
<li id="orbit-language" class="dropdown">

View File

@ -68,12 +68,17 @@
</li>
</ul>
<ul class="orbit-bar-search-sign-language">
<%
google_search_cx = current_site.search['sitesearch'] rescue nil
unless google_search_cx.blank?
%>
<li>
<form id="search" method="get" action="http://www.google.com/cse" target="_blank">
<input type="hidden" name="cx" value="<%= current_site.search['sitesearch'] rescue "" %>">
<input type="hidden" name="cx" value="<%= google_search_cx %>">
<%= text_field_tag 'q', '', {:type => "search", :placeholder => t("search.sitesearch"), 'x-webkit-speech' => ''} %>
</form>
</li>
<% end %>
<li>
<span id="language"><%= t(locale.to_s) %></span>
<ul>

View File

@ -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

View File

@ -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"