regenerate pageparts

This commit is contained in:
Fu Matthew committed 2012-12-27 15:50:05 +08:00
1 parent 2901b8e30c
commit 2d6b70b97f
2 files changed
+10 -2

No files matched your search

+3 -2
View File
@@ -28,7 +28,7 @@ class Page < Item
before_save :create_parts, if: Proc.new { |page| page.new_record? || page.design_id_changed? }
after_save :generate_html
protected
# protected
def create_parts
@@ -38,7 +38,8 @@ class Page < Item
page_design.layout.layout_parts.each do |layout_part|
current_part = self.page_parts.detect{|page_part| page_part.name.eql?(layout_part.name)}
current_part = self.page_parts.build(:name => layout_part.name) unless current_part
if current_part.name.eql?(menu_part.name) && menu_part
if menu_part && current_part.name.eql?(menu_part.name)
if current_part.new_record?
current_part.kind = menu_part.kind
current_part.public_r_tag = menu_part.public_r_tag