lot of changes in fetching
This commit is contained in:
parent
25ca29403c
commit
48323ac1af
Binary file not shown.
After Width: | Height: | Size: 900 B |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -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 = $('<li class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'"><span class="tile '+tilecolor+' '+op+'"></span><a href="" class="appicon"><img src="" alt=""></a><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
|
||||
$li = $('<li class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'"><span class="tile '+tilecolor+' '+op+'"></span><a href="'+tile._id+'" class="appicon"><img src="'+o.iconPath+tile.data_content+'.png" alt="" onclick="return false;" ></a><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
|
||||
else
|
||||
$li = $('<li class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'"><span class="tile '+tilecolor+' '+op+'"></span><h1 class="appname thmtxt">'+tile.title+'</h1><div class="appholder">test content</div></li>');
|
||||
$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 = $('<div class="element w1 h1 hp vp thmc2" data-category="'+app.data_category+'" data-content="'+app.data_content+'"><span class="tile thmc2"></span><a href="'+app._id+'" class="appicon"><img src="'+o.iconPath+app.data_content+'.png" alt="" onclick="return false;"></a><h1 class="appname thmtxt">'+app.title+'</h1></div>');
|
||||
$("#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 = $('<div class="group"><div class="section_label"><ul class="section_grp"></ul></div><ul class="grp" id="section'+(z+1)+'"></ul></div>');
|
||||
for(x=0;x<4;x++){
|
||||
if(x==0){
|
||||
$li = $('<li class="element w1 h1 hp vp thmtxt"><span class="tile thmc1"></span><span class="thmtxt">'+o.sectionList[z].name+'</span></li>');
|
||||
$group.find("ul.section_grp").append($li);
|
||||
}
|
||||
if(z!=x){
|
||||
$lii = $('<li class="element w1 h1 hp vp thmtxt" style="display: none;" data-category="section'+(x+1)+'"><span class="tile thmc2 op06"></span><span class="thmtxt">'+o.sectionList[x].name+'</span></li>');
|
||||
$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 = $('<div class="element w1 h1 hp vp thmc2" data-category="'+app.data_category+'" data-content="'+app.data_content+'"><span class="tile thmc2"></span><a href="'+app._id+'" class="appicon"><img src="'+o.iconPath+app.data_content+'.png" alt="" onclick="return false;"></a><h1 class="appname thmtxt">'+app.title+'</h1></div>');
|
||||
$("#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"});
|
||||
|
|
|
@ -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
|
|
@ -19,8 +19,8 @@
|
|||
<div id="group_wrapper" class="overview">
|
||||
|
||||
<div class="group g_sep op03" id='seperator' style="height: 516px;display:none;"></div>
|
||||
<div class="group_search">
|
||||
<div class="element w1 h1 hp vp thmc2" data-category="desktop">
|
||||
<div class="group_search" id="app_list">
|
||||
<!-- <div class="element w1 h1 hp vp thmc2" data-category="desktop">
|
||||
<span class="tile thmc2"></span>
|
||||
<a href="" class="appicon"><img src="" alt=""></a>
|
||||
<h1 class="appname thmtxt">社團記事</h1>
|
||||
|
@ -174,7 +174,7 @@
|
|||
<span class="tile thmc2"></span>
|
||||
<a href="" class="appicon"><img src="" alt=""></a>
|
||||
<h1 class="appname thmtxt">O-Music</h1>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="scrollbar sb_h"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>
|
||||
<div class="viewport">
|
||||
<div id="group_wrapper" class="overview">
|
||||
<div class="group">
|
||||
<!-- <div class="group">
|
||||
<div class="section_label" >
|
||||
<ul>
|
||||
<li class="element w1 h1 hp vp thmtxt"><span class="tile thmc1"></span><span class="thmtxt">section 1</span></li>
|
||||
|
@ -43,7 +43,7 @@
|
|||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<h1 class="appname thmtxth">Garage Band</h1>
|
||||
</li>
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<h1 class="appname thmtxth">Garage Band</h1>
|
||||
</li>
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
|
@ -67,7 +67,7 @@
|
|||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<h1 class="appname thmtxth">Garage Band</h1>
|
||||
</li>
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<h1 class="appname thmtxth">Garage Band</h1>
|
||||
</li>
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
|
@ -123,7 +123,7 @@
|
|||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<h1 class="appname thmtxth">Garage Band</h1>
|
||||
</li>
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<h1 class="appname thmtxth">Garage Band</h1>
|
||||
</li>
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
|
@ -147,7 +147,7 @@
|
|||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<h1 class="appname thmtxth">Garage Band</h1>
|
||||
</li>
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
<h1 class="appname thmtxth">Garage Band</h1>
|
||||
</li>
|
||||
<li class="element w1 hh2 hp vp" data-category="abc">
|
||||
|
@ -167,7 +167,7 @@
|
|||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Fucking section setting page...
|
||||
section setting page...
|
|
@ -112,6 +112,7 @@ Orbit::Application.routes.draw do
|
|||
match '/desktop/getsectionlist/'=>'desktop#getsectionlist'
|
||||
match '/desktop/settingthemes/'=>'desktop#settingthemes'
|
||||
match '/desktop/settingsections/'=>'desktop#settingsections'
|
||||
match '/desktop/getapplist/'=>'desktop#getapplist'
|
||||
match '/desktop/temp_func/'=>'desktop#temp_func'
|
||||
|
||||
match '/panel/:app_name/front_end/:app_action/:id' => 'pages#show_from_link', :constraints => lambda { |request|
|
||||
|
|
Loading…
Reference in New Issue