add i18n for layout and snippet
This commit is contained in:
1 parent
28612514e3
commit
ff2dffaeb4
14 files changed
+65
-49
No files matched your search
@@ -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,7 +1,6 @@
|
||||
class Layout < CouchFoo::Base
|
||||
|
||||
property :name, String
|
||||
property :content, String #remove later
|
||||
property_i18n :content, String
|
||||
|
||||
validates_presence_of :name
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
class Snippet < CouchFoo::Base
|
||||
|
||||
property :name, String
|
||||
property :content, String # remove later
|
||||
property_i18n :content, String
|
||||
|
||||
validates_presence_of :name
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user