Fix previous commit

This commit is contained in:
chris 2012-12-03 17:38:55 +08:00
parent 6543491a53
commit bdcfb46294
2 changed files with 21 additions and 17 deletions

View File

@ -27,7 +27,7 @@ class Layout < DesignFile
end
def save_pages
self.design.pages.each(&:save)
self.design.pages.each(&:generate_parts)
end
end

View File

@ -26,10 +26,7 @@ class Page < Item
# embeds_many :custom_images, :class_name => 'Image', as: :design_image
protected
def create_parts
if self.new_record? || self.design_id_changed?
def generate_parts
page_design = self.design
parent = self.parent
menu_part = parent.page_parts.detect{|page_part| page_part.kind.eql?('public_r_tag') && page_part.public_r_tag.eql?('sub_menu') && page_part.public_r_tag_object_id.eql?(parent.id.to_s)} if parent
@ -47,6 +44,13 @@ class Page < Item
end
end
end
protected
def create_parts
if self.new_record? || self.design_id_changed?
generate_parts
end
end
def delete_empty_frontend_field