diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f8f55c642..6067c64dc 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -158,7 +158,7 @@ class ApplicationController < ActionController::Base end session[:locale] = condition ? (default_locale || browser_locale || session[:locale]) : I18n.default_locale.to_s I18n.locale = session[:locale].to_sym - @site_in_use_locales = site_locales_default_head(@site.in_use_locales) + @site_in_use_locales = @site.in_use_locales @site_valid_locales = site_locales_default_head(@site.valid_locales) end @@ -203,6 +203,7 @@ class ApplicationController < ActionController::Base def site_locales_default_head(locales) if locales[0].eql? I18n.locale.to_s + Rails.logger.info locales else a = Array.new(locales) diff --git a/app/models/site.rb b/app/models/site.rb index 32ea8835a..609fb44d4 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -29,6 +29,7 @@ class Site field :school field :department + field :default_locale mount_uploader :default_image, ImageUploader mount_uploader :favicon, ImageUploader @@ -40,7 +41,6 @@ class Site field :sub_menu, localize: true field :terms_of_use, localize: true field :google_analytics - field :default_locale field :mobile_on, :type => Boolean, :default => false @@ -58,7 +58,7 @@ class Site def maximum_enabled_locales size = self.in_use_locales.length if size >= 2 - errors.add(:size, "Max 2 ") + errors.add(:size, "Max 2 values allowed") end end diff --git a/app/views/admin/sites/preference.html.erb b/app/views/admin/sites/preference.html.erb index 670c4222b..fc05a6025 100644 --- a/app/views/admin/sites/preference.html.erb +++ b/app/views/admin/sites/preference.html.erb @@ -154,8 +154,11 @@