Sub Menu and Language Fix
This commit is contained in:
parent
01ca178060
commit
e62f91d3fd
|
@ -153,15 +153,15 @@ 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 session[:locale]
|
||||
condition = @site.in_use_locales.include?(session[:locale])
|
||||
elsif params[:locale]
|
||||
condition = @site.in_use_locales.include?(params[:locale])
|
||||
elsif @site.default_locale.present?
|
||||
default_locale = @site.default_locale
|
||||
condition = @site.in_use_locales.include?(default_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 @site.default_locale.present?
|
||||
default_locale = @site.default_locale
|
||||
condition = @site.in_use_locales.include?(default_locale)
|
||||
end
|
||||
|
||||
session[:locale] = condition ? (browser_locale || session[:locale] || default_locale) : I18n.default_locale.to_s
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<div class='category_list'>
|
||||
<!-- <h3 class='h3'><%#= @menu_page.title %></h3> -->
|
||||
<ul class='list'>
|
||||
<% @menu_page.parent.visible_children.each do |child| %>
|
||||
<% @menu_page.parent.parent.visible_children.each do |child| %>
|
||||
<li class="<%= @page_id.eql?(child.id) ? 'active' : nil %>">
|
||||
<a href="<%= (child.class.to_s.eql?('Page') ? '/' + child.path : child.url) %>"><%= child.title %></a>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue