Orbit/app/models/desktop/desktop_widget.rb

31 lines
783 B
Ruby
Raw Normal View History

2012-11-01 12:42:40 +00:00
class DesktopWidget
include Mongoid::Document
include Mongoid::Timestamps
include ParserLayoutWidget
field :name
field :author
field :shape
field :version, :type => String
has_one :css_default, :autosave => true, :dependent => :destroy
has_one :widget_layout, :autosave => true, :dependent => :destroy
has_many :images, :autosave => true, :dependent => :destroy
has_many :javascripts, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :images, :allow_destroy => true
accepts_nested_attributes_for :javascripts, :allow_destroy => true
after_save :parse_css_for_images
# belongs_to :desktop
protected
def parse_css_for_images
self.css_default.parse_widgets_urls
parse_widget_for_images(self)
end
end