Added multi-phone numbers in mobile setting page and fixed language setting

This commit is contained in:
Manson Wang committed 2013-12-12 16:07:27 +08:00
1 parent 4c85d62866
commit afb5afeceb
7 files changed
+69 -23

No files matched your search

+14 -7
View File
@@ -21,20 +21,27 @@ class Admin::SitesController < OrbitBackendController
end
def update
if params[:site][:default_locale] && @site.enable_language_detection.eql?(true)
Site.update_all({:enable_language_detection => false})
elsif params[:site][:enable_language_detection] && @site.default_locale.present?
Site.update_all({:default_locale => nil})
end
if params[:site][:default_bar_color]
params[:site][:mobile_bar_color] = []
end
# if params[:site][:enable_language_detection]
# Site.update_all({:default_locale => nil})
# end
if params[:site][:phone_number].nil?
params[:site][:phone_number] = []
else
params[:site][:phone_number] = params[:site][:phone_number].values
end
@site.update_attributes(params[:site])
if params[:site][:enable_language_detection].eql?("0")
Site.update_all({:enable_language_detection => false})
elsif params[:site][:enable_language_detection].eql?("1")
Site.update_all({:default_locale => nil})
end
redirect_to :back
end
@@ -163,6 +163,7 @@ class ApplicationController < ActionController::Base
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
if browser_locale.eql?("zh")
condition = @site.in_use_locales.include?("zh_tw")
browser_locale = "zh_tw"
else
condition = @site.in_use_locales.include?(browser_locale)
end