stringify i18n locale

This commit is contained in:
2014-07-09 18:03:01 +02:00
parent 98191722e0
commit af57f93892
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ module Cmtool
end
def top_menu
::Page.roots(I18n.locale).select(&:in_menu?)
::Page.roots(I18n.locale.to_s).select(&:in_menu?)
end
end
end
+3 -3
View File
@@ -3,14 +3,14 @@ module Cmtool
module PagesController
def home
page_name = "home"
@page = ::Page.find_by_name_and_locale(page_name, I18n.locale) || ::Page.new(:name => page_name, locale: I18n.locale)
@page = ::Page.find_by_name_and_locale(page_name, I18n.locale.to_s) || ::Page.new(:name => page_name, locale: I18n.locale.to_s)
@sub_pages = @page.children.select{|child| child.in_menu.present? }
render :template => "pages/#{page_name}", :layout => @page.layout.presence || ::Page.layouts.first.to_s
end
# General catcher for pages
def show
@page = ::Page.find_by_name_and_locale(params[:name], I18n.locale)
@page = ::Page.find_by_name_and_locale(params[:name], I18n.locale.to_s)
not_found and return unless @page
@sub_pages = [@page] + @page.children.select{|child| child.in_menu.present? }
@@ -24,7 +24,7 @@ module Cmtool
end
def not_found
@page = ::Page.find_by_name_and_locale('404', I18n.locale) || ::Page.new(name: '404', body: "404 Page Not Found")
@page = ::Page.find_by_name_and_locale('404', I18n.locale.to_s) || ::Page.new(name: '404', body: "404 Page Not Found")
@sub_pages = []
render template: 'pages/404', layout: @page.layout.presence || ::Page.layouts.first.to_s, status: 404
end