Sub Menu and Language Fix

This commit is contained in:
saurabhbhatia 2013-11-22 17:14:47 +08:00
parent 01ca178060
commit e62f91d3fd
2 changed files with 6 additions and 6 deletions

View File

@ -153,15 +153,15 @@ class ApplicationController < ActionController::Base
if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s) if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s)
condition = VALID_LOCALES.include?(session[:locale]) condition = VALID_LOCALES.include?(session[:locale])
#check if the default locale is present or not #check if the default locale is present or not
elsif session[:locale] elsif params[:locale]
condition = @site.in_use_locales.include?(session[: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 elsif @site.enable_language_detection
#check enable langauge detection #check enable langauge detection
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
condition = @site.in_use_locales.include?(browser_locale) 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 end
session[:locale] = condition ? (browser_locale || session[:locale] || default_locale) : I18n.default_locale.to_s session[:locale] = condition ? (browser_locale || session[:locale] || default_locale) : I18n.default_locale.to_s

View File

@ -14,7 +14,7 @@
<div class='category_list'> <div class='category_list'>
<!-- <h3 class='h3'><%#= @menu_page.title %></h3> --> <!-- <h3 class='h3'><%#= @menu_page.title %></h3> -->
<ul class='list'> <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 %>"> <li class="<%= @page_id.eql?(child.id) ? 'active' : nil %>">
<a href="<%= (child.class.to_s.eql?('Page') ? '/' + child.path : child.url) %>"><%= child.title %></a> <a href="<%= (child.class.to_s.eql?('Page') ? '/' + child.path : child.url) %>"><%= child.title %></a>
</li> </li>