2010-08-24 22:59:22 +00:00
|
|
|
class EditableElement
|
|
|
|
|
|
|
|
include Mongoid::Document
|
|
|
|
|
|
|
|
## fields ##
|
|
|
|
field :slug
|
|
|
|
field :block
|
|
|
|
field :default_content
|
2011-03-02 06:38:32 +00:00
|
|
|
field :default_attribute
|
2010-08-24 22:59:22 +00:00
|
|
|
field :hint
|
2011-08-25 16:27:43 +00:00
|
|
|
field :priority, :type => Integer, :default => 0
|
|
|
|
field :disabled, :type => Boolean, :default => false
|
|
|
|
field :assignable, :type => Boolean, :default => true
|
2010-08-27 15:40:03 +00:00
|
|
|
field :from_parent, :type => Boolean, :default => false
|
2010-08-24 22:59:22 +00:00
|
|
|
|
|
|
|
## associations ##
|
|
|
|
embedded_in :page, :inverse_of => :editable_elements
|
|
|
|
|
|
|
|
## validations ##
|
|
|
|
validates_presence_of :slug
|
|
|
|
|
2011-08-25 16:27:43 +00:00
|
|
|
## scopes ##
|
|
|
|
scope :by_priority, :order_by => [[:priority, :desc]]
|
|
|
|
|
2010-08-24 22:59:22 +00:00
|
|
|
## methods ##
|
|
|
|
|
|
|
|
end
|