diff --git a/Gemfile b/Gemfile
index d59de3e8..907187b2 100644
--- a/Gemfile
+++ b/Gemfile
@@ -26,7 +26,7 @@ gem 'sprockets'
gem 'tinymce-rails'
gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")
gem 'mongoid-encryptor', :require => 'mongoid/encryptor'
-# gem 'twitter'
+#gem 'contacts'
# Gems used only for assets and not required
# in production environments by default.
diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js
index fd56bccf..88b34239 100755
--- a/app/assets/javascripts/orbitdesktop.js
+++ b/app/assets/javascripts/orbitdesktop.js
@@ -1,4 +1,3 @@
-
// JavaScript Document
//harry
//Inititialize function will initialize desktop
@@ -16,7 +15,6 @@ var sortAscending = function(a, b) {
var sortDescending = function(a, b) {
return $(a).find("h1").text() < $(b).find("h1").text() ? 1 : -1;
};
-
var orbitDesktop = function(dom){
orbitDesktopAPI.apply(this);
o = this;
@@ -145,7 +143,7 @@ var orbitDesktop = function(dom){
var bindHandlers = function(){ // this function will bind all the handlers in the desktop
var groupWrapperWidth = 0;
$("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);});
-
+ var grps = new Array;
$("div#desktop #group_wrapper").css("width",groupWrapperWidth);
var first = true;
$("div#desktop .g_col").sortable({
@@ -156,6 +154,27 @@ var orbitDesktop = function(dom){
helper: 'clone',
stop:function(){
first = true;
+ var grpwidth = 0;
+ for(i in grps){
+ var grp = grps[i];
+ if(grp.find(".element").length == 0){
+ grp.animate({"width":"0px"},500,function(){$(this).remove();});
+ grpwidth+=225;
+ }
+ }
+ grps = [];
+ $("#group_wrapper").width($("#group_wrapper").width()-grpwidth);
+ },
+ start:function(){
+ $("#group_wrapper").find("div.group").each(function(i,par){
+ var nextnumber = $(this).find("ul").length;
+ $newcol = $('
');
+ $(this).append($newcol);
+ $newcol.sortable({connectWith: '.g_col'});
+ grps.push($newcol);
+ $("#group_wrapper").width($("#group_wrapper").width()+225);
+ });
+ $("div#desktop .g_col").sortable('refresh');
},
update:function(){
if(first){
@@ -180,7 +199,11 @@ var orbitDesktop = function(dom){
if ((last.top+lasth)>528){
$(this).sortable('cancel');
}
- }else{$(this).remove();}
+ }
+ $("#group_wrapper ul").each(function(){
+ if($(this).find('.element').length == 0)
+ $(this).animate({"width":"0px"},500,function(){$(this).remove();});
+ })
},
receive: function(event, ui){
var s = $(this).find('.element').length,
@@ -1174,6 +1197,7 @@ var orbitDesktop = function(dom){
.addClass('op00', 500);
}
$("div#apps_store div#panel_r").load("/desktop_appstore/widgets",function(){
+
$.getJSON("/desktop_appstore/getuserwidgets",function(userwidgets){
var column = $(''),
counter = 1,
@@ -1211,7 +1235,7 @@ var orbitDesktop = function(dom){
if(s_name_list_not)
li.find("div.not_status").html("Install on "+s_name_list_not);
}else{
- li.find("div.not_status").html("Install on "+o.sectionList[0].name+", "+o.sectionList[1].name+", "+o.sectionList[2].name+", "+o.sectionList[3].name);
+ li.find("div.not_status").html("Install on "+o.sectionList[0].name+" "+o.sectionList[1].name+" "+o.sectionList[2].name+" "+o.sectionList[3].name)+"";
}
//console.log(section_names);
column.find("ul").append(li);
diff --git a/app/controllers/otheraccounts_controller.rb b/app/controllers/otheraccounts_controller.rb
index ea6cff24..454f108e 100644
--- a/app/controllers/otheraccounts_controller.rb
+++ b/app/controllers/otheraccounts_controller.rb
@@ -32,6 +32,7 @@ class OtheraccountsController< ApplicationController
@decrypted_password = @gmailaccount.first.encrypted_password.decrypt
@email = @gmailaccount.first.email
url = URI.parse("https://mail.google.com/mail/feed/atom")
+ #url = URI.parse("https://www.google.com/m8/feeds/contacts/default/full")
req = Net::HTTP::Get.new(url.path)
req.basic_auth @email, @decrypted_password
req.content_type = 'text/xml'
@@ -57,6 +58,16 @@ class OtheraccountsController< ApplicationController
# oauth_token = oauth.request_token.token
# oauth_secret = oauth.request_token.secret
+ #require File.dirname(__FILE__)+"/../lib/contacts"
+ @gmailaccount = OtherAccount.where(:type.all => ["gmail"],:user_id.all => [current_user.id]) rescue nil
+ if @gmailaccount.first != nil
+ login = @gmailaccount.first.encrypted_password.decrypt
+ password = @gmailaccount.first.email
+
+ @contacts = Contacts::Gmail.new(login, password).contacts
+
+ render :json => @contacts.to_json
+ end
end