Model commit

This commit is contained in:
Harry Bomrah authored and Christophe Vilayphiou committed 2012-04-06 17:47:04 +08:00
1 parent 79f005c88e
commit f5c080efd4
7 files changed
+71 -3

No files matched your search

+1 -1
View File
@@ -65,7 +65,7 @@ var orbitDesktop = function(dom){
})
$(window).resize(function(){
var ww = $(window).width();
$("img#thmbackground").attr({"width":ww})
$("img#thmbackground").attr({"width":ww});
});
$(o.contentHolder).mousemove(function(event){
/*if(($(window).width()-50)<=event.pageX){
+9 -1
View File
@@ -1,6 +1,6 @@
class DesktopController< ApplicationController
layout 'desktop'
before_filter :authenticate_user!
def index
end
@@ -16,4 +16,12 @@ class DesktopController< ApplicationController
def sections
render :layout => false
end
def save_desktop_theme
end
def get_desktop_theme
end
end
+16
View File
@@ -0,0 +1,16 @@
class Desktop
include Mongoid::Document
include Mongoid::Timestamps
field :theme, default: "default"
belongs_to :user
has_many :sections, :autosave => true, :dependent => :destroy
before_create :initialize_section
def initialize_section
user.self.build_section
end
end
+14
View File
@@ -0,0 +1,14 @@
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
self.build_tile
end
end
+16
View File
@@ -0,0 +1,16 @@
class Section
include Mongoid::Document
include Mongoid::Timestamps
field :name, default: "Section"
belongs_to :desktop
has_many :groups, :autosave => true, :dependent => :destroy
before_create :initialize_group
def initialize_group
self.build_group
end
end
+8
View File
@@ -0,0 +1,8 @@
class Tile
include Mongoid::Document
include Mongoid::Timestamps
belongs_to :group
end
+7 -1
View File
@@ -16,11 +16,13 @@ class User
has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth"
has_many :managing_apps,:class_name => "AppManager"
has_one :desktop, :autosave => true, :dependent => :destroy
belongs_to :role
has_and_belongs_to_many :sub_roles
accepts_nested_attributes_for :attribute_values, :allow_destroy => true
before_create :initialize_desktop
def avb_apps
sub_role_ids_ary=self.sub_roles.collect{|t| t.id}
query1 = AppAuth.any_in({sub_role_ids: sub_role_ids_ary}).excludes(blocked_user_ids: self.id)
@@ -53,4 +55,8 @@ class User
User.find(id) rescue nil
end
def initialize_desktop
self.build_desktop
end
end