Fetching desktop from db

This commit is contained in:
Harry Bomrah committed 2012-04-11 15:31:10 +08:00
1 parent eb219c14b7
commit 4875b339f8
24 files changed
+470 -41

No files matched your search

+34
View File
@@ -3,6 +3,7 @@ class DesktopController< ApplicationController
before_filter :authenticate_user!
def index
@desktop = current_user.desktop
@section = @desktop.sections.first
end
def desktop
@@ -34,4 +35,37 @@ class DesktopController< ApplicationController
def settings
render :layout => false
end
def getgroups
@section = Section.find(params["sectionid"])
@groups = @section.groups
a = Array.new
@groups.each do |group|
a << group.tiles
end
render :json =>a.to_json
end
def getsectionlist
@desktop = Desktop.find(params["desktopid"])
@sections = @desktop.sections
render :json => @sections.to_json
end
def temp_func
@section = Section.find(params["sectionid"])
@groups = @section.groups
@groups.each do |group|
a = 1;
@tiles = group.tiles
@tiles.each do |tile|
tile.update_attributes({:data_category => "widget",:data_content => "temp", :position => a})
a = a+1;
end
end
b = Array.new
b << {"success"=>"true"}
render :json=>b.to_json
end
end