Let page edit from can select layout

This commit is contained in:
Wen-Tien Chang committed 2010-01-28 17:42:55 +08:00
1 parent 12de9d2514
commit 8da5323fd0
8 files changed
+24 -4

No files matched your search

+4 -1
View File
@@ -4,5 +4,8 @@ class Component < Item
key :engine_name, String
key :layout_name, String, :required => true
key :layout_id, String, :required => true
belongs_to :layout
end
+5
View File
@@ -44,6 +44,11 @@ class Item
else
self.parent_id = Item.find_by_name( self.parent_name ).id
end
if self.layout_name
self.layout_id = Layout.find_by_name( self.layout_name ).id
end
end
end
+3
View File
@@ -3,6 +3,9 @@ class Layout
include MongoMapper::Document
key :name, String, :required => true, :index => true
key :description, String
key_i18n :content, String
validates_format_of :name, :with => /^[a-zA-Z-_]+$/
end
+4 -1
View File
@@ -4,5 +4,8 @@ class Page < Item
key_i18n :content, String
key :layout_name, String, :required => true
key :layout_id, String, :required => true
belongs_to :layout
end