This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
2012-04-03 10:25:41 +00:00
|
|
|
class Group
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
|
|
|
|
belongs_to :section
|
|
|
|
has_many :tiles, :autosave => true, :dependent => :destroy
|
|
|
|
before_create :initialize_tile
|
|
|
|
|
|
|
|
def initialize_tile
|
2013-05-14 09:18:05 +00:00
|
|
|
# self.tiles.build(data_category: "app", data_content: "quotes", position: 5, shape: "w1 h1", title: "Quotes")
|
|
|
|
# self.tiles.build(data_category: "app", data_content: "dailyenglish", position: 6, shape: "w1 h1", title: "Daily English Word")
|
2012-11-05 15:04:54 +00:00
|
|
|
widgets = self.section.desktop.desktop_widgets.collect{|widget| widget.id}
|
2013-05-14 09:18:05 +00:00
|
|
|
widgets.each_with_index do |w,i|
|
|
|
|
self.tiles.build(data_category: "widget", position: i+1,desktop_widget_id: w)
|
2012-11-05 15:04:54 +00:00
|
|
|
end
|
2012-04-03 10:25:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|