Modifications for design, pages, page_parts…
Move orbit_bar out of kernel.js
This commit is contained in:
1 parent
5da75161c4
commit
9cd3cbc478
11 files changed
+25
-34
No files matched your search
@@ -15,7 +15,7 @@ class Design
|
||||
embeds_many :themes, :cascade_callbacks => true
|
||||
embeds_many :javascripts, :cascade_callbacks => true
|
||||
embeds_many :images, :cascade_callbacks => true
|
||||
embeds_many :custom_images, :class_name => 'Image', :cascade_callbacks => true
|
||||
# embeds_many :custom_images, :class_name => 'Image', :cascade_callbacks => true
|
||||
|
||||
validates_presence_of :title
|
||||
validates_presence_of :author
|
||||
|
||||
@@ -7,7 +7,7 @@ class Layout < DesignFile
|
||||
embedded_in :design
|
||||
embeds_many :layout_parts
|
||||
|
||||
after_save :parse_layout
|
||||
before_save :parse_layout
|
||||
|
||||
def content
|
||||
self.file.read.force_encoding("UTF-8") rescue ''
|
||||
|
||||
@@ -4,15 +4,7 @@ class LayoutPart
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :name
|
||||
field :id_tag
|
||||
field :editable, :type => Boolean
|
||||
field :class_tag
|
||||
field :content
|
||||
|
||||
embedded_in :layout
|
||||
|
||||
def editable?
|
||||
self.editable
|
||||
end
|
||||
|
||||
end
|
||||
+11
-7
@@ -9,17 +9,21 @@ class Page < Item
|
||||
has_many :page_parts, :autosave => true, :dependent => :destroy
|
||||
accepts_nested_attributes_for :page_parts, :allow_destroy => true
|
||||
|
||||
# embeds_many :custom_images, :class_name => 'Image', as: :design_image
|
||||
before_save :create_parts
|
||||
|
||||
def create_parts
|
||||
page_design = self.design
|
||||
page_design.layout.layout_parts.each do |p|
|
||||
self.page_parts.create( :name => p.name, :i18n_variable => I18nVariable.create, :kind => 'text' ) if p.editable?
|
||||
end
|
||||
end
|
||||
# embeds_many :custom_images, :class_name => 'Image', as: :design_image
|
||||
|
||||
def is_home?
|
||||
self.parent ? false : true
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def create_parts
|
||||
page_design = self.design
|
||||
page_design.layout.layout_parts.each do |layout_part|
|
||||
self.page_parts.new(:name => layout_part.name) unless self.page_parts.detect{|page_part| page_part.name.eql?(layout_part.name)}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user