diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js
index 11f9e132..623f3f6b 100755
--- a/app/assets/javascripts/orbitdesktop.js
+++ b/app/assets/javascripts/orbitdesktop.js
@@ -162,13 +162,15 @@ var orbitDesktop = function(dom){
$.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids});
},
update:function(){
- var s = $(this).find('.element').length,
- last = $(this).find('.element').eq(s-1).position(),
- lasth = $(this).find('.element').eq(s-1).outerHeight(true);
-
- if ((last.top+lasth)>528){
- $(this).sortable('cancel');
- }
+ var s = $(this).find('.element').length;
+ if(s!=0){
+ last = $(this).find('.element').eq(s-1).position(),
+ lasth = $(this).find('.element').eq(s-1).outerHeight(true);
+
+ if ((last.top+lasth)>528){
+ $(this).sortable('cancel');
+ }
+ }else{$(this).remove();}
},
receive: function(event, ui){
@@ -216,39 +218,51 @@ var orbitDesktop = function(dom){
$li,
bdsum = 0,
bwsum = 0,
- bhsum = 0;
-
+ bhsum = 0,
+ small = 0,
+ single = false;
$group.append($col);
-
- $.each(group,function(j,tile){
- var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)];
- var op = opacity[Math.floor(Math.random()*opacity.length)];
- if(j==0)$group.attr("id",tile.group_id);
-
- if(tile.data_category == "app")
- $li = $('
'+tile.title+'
');
- else
- $li = $(''+tile.title+'
Loading...
');
- // $group.find("ul").append($li);
-
- // column experiment start
+ for(j=0;j 8 ){
- bdsum = 0, bhsum = 0, colindex+=1;
+
+ if(bdsum > 8 || bhsum > 6){
+ bdsum = 0, bhsum = 0, colindex++,j--;
$group.append('');
- $group.find('.col'+colindex).eq(colindex).append($li);
- } else {
- $group.find('.col'+colindex).eq(0).append($li);
+ }else{
+ var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)];
+ var op = opacity[Math.floor(Math.random()*opacity.length)];
+ if(j==0)$group.attr("id",tile.group_id);
+
+ if(tile.data_category == "app")
+ $li = $(''+tile.title+'
');
+ else
+ $li = $(''+tile.title+'
Loading...
');
+
+ $group.find('.col'+colindex).append($li);
}
-
- });
+ }
$("div#desktop div#group_wrapper").append($group);
})
bindHandlers();
@@ -345,8 +359,19 @@ var orbitDesktop = function(dom){
allApps = $("div#app_manager .group_search .element").sort(sortDescending);
break;
}
-
- $("div#app_manager .group_search").html(allApps);
+ $("div#app_manager #app_list").empty();
+ var count = 0, colindex = 0;
+ $('#app_list').append('');
+ $.each(allApps,function(i,app){
+ count++;
+ if( count > 4 ){
+ count = 1, colindex+=1;
+ $('#app_list').append('');
+ $('.g_col.col'+ colindex).append(app);
+ } else {
+ $('.g_col.col'+ colindex).append(app);
+ }
+ })
return false;
})
$('.tinycanvas')
@@ -362,11 +387,8 @@ var orbitDesktop = function(dom){
$.each(appss,function(i,apps){
$.each(apps,function(i,app){
var $app;
-
count++;
-
$app = $(''+app.title+'
');
-
if( count > 4 ){
count = 1, colindex+=1;
$('#app_list').append('');
@@ -374,10 +396,6 @@ var orbitDesktop = function(dom){
} else {
$('.g_col.col'+ colindex).append($app);
}
-
-
-
- console.log(count, colindex);
})
})
@@ -736,7 +754,23 @@ var orbitDesktop = function(dom){
var connection = function(){
var bindHandlers = function(){
-
+ $("#gmail_connect_btn").click(function(){
+ var usernm = $("input#gmail_username").val(),
+ pwd = $("input#gmail_password").val(),
+ type = $(this).attr("href"),
+ what = "edit";
+ if(usernm!="" && pwd!="")
+ saveaccount(usernm,pwd,type,what);
+
+ })
+ }
+ var saveaccount = function(usernm,pwd,type,what){
+ $.post("/desktop/save_account_info",{email:usernm,password:pwd,account:type,dowhat:what},function(result){
+ if(result[0].success=="true")
+ o.notify("Gmail account connected!!","success",2);
+ else
+ o.notify("Gmail account connection failed!!","imp",2);
+ })
}
$("div#settings div#panel_r").load("/desktop/settingconnection",function(){
bindHandlers();
@@ -845,7 +879,7 @@ var orbitDesktop = function(dom){
})
};
this.saveWallpaper = function(wallpaper){ // this function saves wallpaper in db
- $.post("desktop/save_desktop_settings",{"save":"wallpaper","wallpapernm":wallpaper,"desktopid":o.desktopId},function(result,status){
+ $.post("desktop/save_desktop_settings",{"save":"wallpaper","wallpapernm":wallpaper,"desktopid":o.desktopId},function(result){
if(result[0].success=="true")
o.notify("Wallpaper saved!!","success",2);
else
diff --git a/app/controllers/otheraccounts_controller.rb b/app/controllers/otheraccounts_controller.rb
index 2f76c905..a9e9b858 100644
--- a/app/controllers/otheraccounts_controller.rb
+++ b/app/controllers/otheraccounts_controller.rb
@@ -6,10 +6,17 @@ class OtheraccountsController< ApplicationController
include REXML
def saveaccountinfo
+ @dowhat = params['dowhat']
@email = params['email']
@password = params['password']
@account = params['account']
- OtherAccount.create(user_id: current_user.id, email: @email, encrypted_password: @password, type: @account)
+ case @dowhat
+ when "new"
+ OtherAccount.create(user_id: current_user.id, email: @email, encrypted_password: @password, type: @account)
+ when "edit"
+ @otheraccount = OtherAccount.where(:type.all => [@account],:user_id.all => [current_user.id])
+ @otheraccount.first.update_attributes(:email => @email, :encrypted_password => @password)
+ end
a = Array.new
a << {"success"=>"true"}
render :json=>a.to_json
diff --git a/app/views/desktop/app_manager.html.erb b/app/views/desktop/app_manager.html.erb
index 5cc45db8..b6a54fe3 100755
--- a/app/views/desktop/app_manager.html.erb
+++ b/app/views/desktop/app_manager.html.erb
@@ -21,157 +21,7 @@
-