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

+2 -4
View File
@@ -1,11 +1,9 @@
require 'couch_foo'
class Announcement < CouchFoo::Base
property :title, String
property :content, String
property_i18n :title, String
property_i18n :content, String
validates_presence_of :title
def to_liquid
{ "id" => self.id, "title" => self.title, "content" => self.content }
end
-1
View File
@@ -1,7 +1,6 @@
class Layout < CouchFoo::Base
property :name, String
property :content, String #remove later
property_i18n :content, String
validates_presence_of :name
-1
View File
@@ -1,7 +1,6 @@
class Snippet < CouchFoo::Base
property :name, String
property :content, String # remove later
property_i18n :content, String
validates_presence_of :name
+1 -1
View File
@@ -4,7 +4,7 @@ module SnippetFilter
snippet = Snippet.find_by_name(snippet_name)
if snippet
return Liquid::Template.parse(snippet.content).render
return Liquid::Template.parse( snippet.read_attribute( "content_#{I18n.locale}" ) ).render
else
return "nothing"
end