add i18n for layout and snippet

This commit is contained in:
Wen-Tien Chang committed 2009-07-06 16:23:34 +08:00
1 parent 28612514e3
commit ff2dffaeb4
14 files changed
+65 -49

No files matched your search

+4 -1
View File
@@ -36,7 +36,10 @@ class Admin::SnippetsController < ApplicationController
end
end
@snippet.content = "<ul>\n#{lis}</ul>"
VALID_LOCALES.each do |locale|
@snippet.write_attribute( "content_#{locale}", "<ul>\n#{lis}</ul>" )
end
end
respond_to do |format|
+1 -1
View File
@@ -14,7 +14,7 @@ class ApplicationController < ActionController::Base
@layout = @page.layout
@page_options ||= {}
@page_content = Liquid::Template.parse( @page.read_attribute( "content_#{I18n.locale}" ) ).render(@page_options)
@layout_content = (@page.layout)? @layout.content : "{{page_content}}"
@layout_content = (@page.layout)? @layout.read_attribute( "content_#{I18n.locale}" ) : "{{page_content}}"
render :text => Liquid::Template.parse(@layout_content).render( 'page_content' => @page_content )
else
render :text => '404 Not Found'
+2 -2
View File
@@ -13,8 +13,8 @@ class PagesController < ApplicationController
@page = Page.find_by_name(params[:page_name])
if @page && !@page.external_link.blank?
redirect_to @page.external_link
elsif @page && @page.use_engine
# redirect_to @page.external_link
elsif @page && !@page.use_engine.blank?
#model_class = Kernel.const_get( "Announcement" ) # page.use_engine
redirect_to announcements_path
else