diff --git a/app/assets/images/icons/dailyenglish.png b/app/assets/images/icons/dailyenglish.png new file mode 100644 index 00000000..c820bd61 Binary files /dev/null and b/app/assets/images/icons/dailyenglish.png differ diff --git a/app/assets/images/icons/quotes.png b/app/assets/images/icons/quotes.png new file mode 100644 index 00000000..d22866fd Binary files /dev/null and b/app/assets/images/icons/quotes.png differ diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index fa032ffd..7179cad6 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -12,6 +12,7 @@ var orbitDesktop = function(dom){ this.currentface = "home"; this.desktopData = {"home":"","settings":"","work":"","favorite":"","apps_manager":"","sections":""}; this.tp = ""; + this.sectionList; this.initialize = function(){ var theme = o.theme; $.getJSON("/desktop/get_desktop_settings",{id:o.desktopId},function(desktopSettings){ @@ -112,7 +113,7 @@ var orbitDesktop = function(dom){ $(".group").each(function(){groupWrapperWidth+=$(this).width();}) groupWrapperWidth+=200; groupWrapperHeight = $(".group").height() + 20; - groupWrapperHeight = (groupWrapperHeight > ($(window).height()-extraspace))? $(window).height()-extraspace:groupWrapperHeight; + // groupWrapperHeight = (groupWrapperHeight > ($(window).height()-extraspace))? $(window).height()-extraspace:groupWrapperHeight; $("#group_wrapper").css("width",groupWrapperWidth); $(".grp").sortable({ @@ -172,7 +173,7 @@ var orbitDesktop = function(dom){ var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)]; var op = opacity[Math.floor(Math.random()*opacity.length)]; if(tile.data_category == "app") - $li = $('
  • '+tile.title+'

  • '); + $li = $('
  • '+tile.title+'

  • '); else $li = $('
  • '+tile.title+'

    test content
  • '); $group.find("ul").append($li); @@ -185,6 +186,7 @@ var orbitDesktop = function(dom){ } var loadSectionList = function(){ $.getJSON("/desktop/getsectionlist",{desktopid:o.desktopId},function(sectionlist){ + o.sectionList = eval(sectionlist); $.each(sectionlist,function(i,section){ var tempstyle=""; if(i==0){ @@ -266,9 +268,22 @@ var orbitDesktop = function(dom){ }) $('.tinycanvas').tinyscrollbar({ axis: 'x'}); } + var loadApps = function(){ + $.getJSON("/desktop/getapplist",{desktopid:o.desktopId},function(appss){ + $.each(appss,function(i,apps){ + $.each(apps,function(i,app){ + var $div; + $div = $('

    '+app.title+'

    '); + $("#app_list").append($div); + }) + }) + + bindHandlers(); + }) + } if(!o.desktopData[o.currentface]){ $(o.contentHolder).empty().load("/desktop/"+target,function(){ - bindHandlers(); + loadApps(); }); }else{ $(o.contentHolder).html(o.desktopData[o.currentface]); @@ -313,17 +328,45 @@ var orbitDesktop = function(dom){ if( !$sdm.children('.sdm_o') ){ return; } else { - $sdm.hover(function(){ - $(this).addClass('thmc2'); - }, function(){ - $(this).removeClass('thmc2'); - }); + $sdm.hover(function(){$(this).addClass('thmc2');}, function(){$(this).removeClass('thmc2');}); } }; - + var loadApps = function(){ + $.getJSON("/desktop/getapplist",{desktopid:o.desktopId},function(appss){ + var $group,$lii,$li; + var z=0; + for(section in o.sectionList){ + $group = $('
    '); + for(x=0;x<4;x++){ + if(x==0){ + $li = $('
  • '+o.sectionList[z].name+'
  • '); + $group.find("ul.section_grp").append($li); + } + if(z!=x){ + $lii = $(''); + $group.find("ul.section_grp").append($lii); + } + } + z++; + $("div#group_wrapper").append($group); + } + $.each(appss,function(i,apps){ + var y=0; + $.each(apps,function(i,app){ + var $div; + $div = $('

    '+app.title+'

    '); + $("#app_list").append($div); + }) + y++; + }) + + + bindHandlers(); + }) + } if(!o.desktopData[o.currentface]){ $(o.contentHolder).empty().load("/desktop/"+target,function(){ - bindHandlers(); + loadApps(); }); }else{ $(o.contentHolder).html(o.desktopData[o.currentface]); @@ -405,7 +448,7 @@ var orbitDesktop = function(dom){ $(o.contentHolder).empty().load("/desktop/"+target,function(){ bindHandlers(); - sections(); + themes(); }); }; this.loadWallpaper = function(wallpaper){ @@ -447,6 +490,7 @@ orbitDesktop.prototype.themefolder = "themes"; orbitDesktop.prototype.widgetfolder = "desktop_widgets"; orbitDesktop.prototype.desktopId = "1"; orbitDesktop.prototype.notifyImgPath = "temp"; +orbitDesktop.prototype.iconPath = "/assets/icons/"; var uselessfunction = function(){ $.post("/desktop/temp_func",{sectionid:"4f83e7bbbd98eb041600001d"}); diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index d426b4da..ca776043 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -1,6 +1,9 @@ class DesktopController< ApplicationController layout 'desktop' before_filter :authenticate_user! + + #to load pages... + def index @desktop = current_user.desktop @section = @desktop.sections.first @@ -18,6 +21,19 @@ class DesktopController< ApplicationController def sections render :layout => false end + def settings + render :layout => false + end + + def settingthemes + render "desktop/settings/themes", :layout => false + end + + def settingsections + render "desktop/settings/sections", :layout => false + end + + #ajax data load.... def save_desktop_settings @desktop = Desktop.find(params["id"]) @@ -32,18 +48,6 @@ class DesktopController< ApplicationController render :json => @desktop.to_json end - def settings - render :layout => false - end - - def settingthemes - render "desktop/settings/themes", :layout => false - end - - def settingsections - render "desktop/settings/sections", :layout => false - end - def getgroups @section = Section.find(params["sectionid"]) @groups = @section.groups @@ -76,4 +80,18 @@ class DesktopController< ApplicationController b << {"success"=>"true"} render :json=>b.to_json end + + def getapplist + @desktop = Desktop.find(params["desktopid"]) + @sections = @desktop.sections + a = Array.new + @sections.each do |section| + @groups = section.groups + @groups.each do |group| + @tiles = group.tiles.where(:data_category.all => ["app"]) + a << @tiles + end + end + render :json=>a.to_json + end end \ No newline at end of file diff --git a/app/views/desktop/app_manager.html.erb b/app/views/desktop/app_manager.html.erb index fdbe9236..682ef540 100755 --- a/app/views/desktop/app_manager.html.erb +++ b/app/views/desktop/app_manager.html.erb @@ -19,8 +19,8 @@
    -