change site controller

This commit is contained in:
chiu 2020-07-23 16:17:22 +08:00
parent 260e4ee606
commit 09ee21921a
1 changed files with 5 additions and 1 deletions

View File

@ -124,7 +124,11 @@ class Admin::SitesController < OrbitAdminController
if params[:site][:enable_language_detection].eql?("0") if params[:site][:enable_language_detection].eql?("0")
Site.update_all({:enable_language_detection => false}) Site.update_all({:enable_language_detection => false})
elsif params[:site][:enable_language_detection].eql?("1") elsif params[:site][:enable_language_detection].eql?("1")
if @site.in_use_locales.include?(:en)
Site.update_all({:default_locale => nil}) Site.update_all({:default_locale => nil})
else
Site.update_all({:enable_language_detection => false})
end
end end
if !@site.in_use_locales.include?I18n.locale if !@site.in_use_locales.include?I18n.locale
I18n.locale = @site.in_use_locales.first I18n.locale = @site.in_use_locales.first