Desktop Widgtes updates..

This commit is contained in:
Harry Bomrah authored and chris committed 2012-11-06 10:36:34 +08:00
1 parent 3c85f3ef00
commit da5e7f670e
33 files changed
+217 -146

No files matched your search

+2 -1
View File
@@ -2,11 +2,12 @@ class Desktop
include Mongoid::Document
include Mongoid::Timestamps
field :theme, default: "4f8d3f493b67fcd05f086359"
field :theme, default: "4f8d3f533b67fcd05f08635a"
field :customtheme
field :wallpaper
belongs_to :user
has_and_belongs_to_many :desktop_widgets, :autosave => true
has_many :sections, :autosave => true, :dependent => :destroy
# has_many :desktop_widgets, :autosave => true, :dependent => :destroy
+7 -5
View File
@@ -8,13 +8,15 @@ class DesktopWidget
field :shape
field :version, :type => String
has_one :css_default, :autosave => true, :dependent => :destroy
has_one :css_default, as: :css, :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
has_many :images, as: :imgs, :autosave => true, :dependent => :destroy
has_many :javascripts, as: :js, :autosave => true, :dependent => :destroy
has_and_belongs_to_many :desktops, :autosave => true
belongs_to :tiles, :autosave => true
accepts_nested_attributes_for :images, :allow_destroy => true
accepts_nested_attributes_for :javascripts, :allow_destroy => true
accepts_nested_attributes_for :javascripts, :allow_destroy => true
after_save :parse_css_for_images
@@ -24,7 +26,7 @@ class DesktopWidget
protected
def parse_css_for_images
self.css_default.parse_widgets_urls
self.css_default.parse_urls
parse_widget_for_images(self)
end
+6 -7
View File
@@ -7,13 +7,12 @@ class Group
before_create :initialize_tile
def initialize_tile
self.tiles.build(data_category: "widget", data_content: "timetable", position: 1, shape: "w2 h2", title: "Tiime Table")
self.tiles.build(data_category: "app", data_content: "quotes", position: 2, shape: "w1 h1", title: "Quotes")
self.tiles.build(data_category: "widget", data_content: "weather", position: 3, shape: "w2 h2", title: "Weather")
self.tiles.build(data_category: "widget", data_content: "clock", position: 4, shape: "w2 h1", title: "Clock")
self.tiles.build(data_category: "app", data_content: "dailyenglish", position: 5, shape: "w1 h1", title: "Daily English Word")
self.tiles.build(data_category: "widget", data_content: "school_events", position: 6, shape: "w2 h1", title: "School Events")
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")
widgets = self.section.desktop.desktop_widgets.collect{|widget| widget.id}
for i in 0..3
self.tiles.build(data_category: "widget", position: i+1,desktop_widget_id: widgets[i])
end
end
end
+1
View File
@@ -9,5 +9,6 @@ class Tile
field :title
belongs_to :group
has_one :desktop_widget
end
+1 -1
View File
@@ -5,7 +5,7 @@ class WidgetLayout < DesignFile
field :body
belongs_to :desktop_widget
def content
self.file.read.force_encoding("UTF-8") rescue ''