diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1b87254b..b959d85c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -146,17 +146,18 @@ class ApplicationController < ActionController::Base if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s) condition = VALID_LOCALES.include?(session[:locale]) #check if the default locale is present or not - elsif @site.default_locale.present? - default_locale = @site.default_locale - condition = @site.in_use_locales.include?(default_locale) - elsif !@site.enable_language_detection + elsif session[:locale] + condition = @site.in_use_locales.include?(session[:locale]) + elsif @site.enable_language_detection #check enable langauge detection browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil condition = @site.in_use_locales.include?(browser_locale) - elsif session[:locale] - condition = @site.in_use_locales.include?(session[:locale]) + elsif @site.default_locale.present? + default_locale = @site.default_locale + condition = @site.in_use_locales.include?(default_locale) end - session[:locale] = condition ? (default_locale || browser_locale || session[:locale]) : I18n.default_locale.to_s + + session[:locale] = condition ? (browser_locale || session[:locale] || default_locale) : I18n.default_locale.to_s I18n.locale = session[:locale].to_sym @site_in_use_locales = @site.in_use_locales @site_valid_locales = site_locales_default_head(@site.valid_locales) diff --git a/app/views/admin/items/_site_bar.html.erb b/app/views/admin/items/_site_bar.html.erb index 0a83994b..1397a3d4 100644 --- a/app/views/admin/items/_site_bar.html.erb +++ b/app/views/admin/items/_site_bar.html.erb @@ -1,14 +1,3 @@ - - \ No newline at end of file diff --git a/app/views/admin/sites/_side_bar.html.erb b/app/views/admin/sites/_side_bar.html.erb index 5ddb07e5..9ab39fa4 100644 --- a/app/views/admin/sites/_side_bar.html.erb +++ b/app/views/admin/sites/_side_bar.html.erb @@ -21,6 +21,6 @@ + - \ No newline at end of file diff --git a/app/views/admin/sites/preference.html.erb b/app/views/admin/sites/preference.html.erb index eec4f860..cbcc290d 100644 --- a/app/views/admin/sites/preference.html.erb +++ b/app/views/admin/sites/preference.html.erb @@ -121,14 +121,14 @@
- <%= f.check_box :backend_openness_on , :class=>"toggle-check", :data=> { disabled: true } %> + <%= f.check_box :backend_openness_on , :class=>"toggle-check", :data=> { disabled: true } %> All users can visit backend pages
- <%= f.check_box :desktop_closed , :class=>"toggle-check", :data=> { disabled: true } %> + <%= f.check_box :desktop_closed , :class=>"toggle-check", :data=> { disabled: true } %>
@@ -164,7 +164,7 @@
<% @site_in_use_locales.each do |locale| %> - <%= radio_button_tag "site[default_locale]", locale, @locale == locale ,:class=>"toggle-check in_use_locales", :data => { :title => "#{I18nVariable.from_locale(locale)}", disabled: true } %> + <%= radio_button_tag "site[default_locale]", locale, @locale == locale , @site.in_use_locales.include?(locale),:class=>"toggle-check in_use_locales", :data => { :title => "#{I18nVariable.from_locale(locale)}", disabled: true } %> <% end %>
diff --git a/app/views/admin/users_new_interface/_side_bar.html.erb b/app/views/admin/users_new_interface/_side_bar.html.erb index 14874137..1f43a026 100644 --- a/app/views/admin/users_new_interface/_side_bar.html.erb +++ b/app/views/admin/users_new_interface/_side_bar.html.erb @@ -20,6 +20,7 @@ <% end -%> <% end -%> + - diff --git a/config/mongoid.yml b/config/mongoid.yml index 1b3b0585..49a7167c 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -8,7 +8,7 @@ defaults: &defaults development: <<: *defaults - database: test_site_new + database: test_site @@ -24,4 +24,4 @@ production: # password: <%= ENV['MONGOID_PASSWORD'] %> # database: <%= ENV['MONGOID_DATABASE'] %> <<: *defaults - database: test_site_new + database: test_site