few experiments…

This commit is contained in:
Harry Bomrah 2012-05-16 11:18:54 +08:00
parent 1a9fa8f505
commit 75cbae049b
3 changed files with 41 additions and 4 deletions

View File

@ -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.

View File

@ -145,7 +145,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 +156,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 = $('<ul class="g_col g_col_w2 col'+nextnumber+' ui-sortable">');
$(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 +201,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,
@ -1162,6 +1187,7 @@ var orbitDesktop = function(dom){
})
}
$("div#apps_store div#panel_r").load("/desktop_appstore/widgets",function(){
$.getJSON("/desktop_appstore/getuserwidgets",function(userwidgets){
var column = $('<div class="g_col list_t" style="width:350px;"><ul></ul></div>'),
counter = 1,
@ -1199,7 +1225,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 <a href='addthis' for='"+o.sectionList[0]._id+"' style='text-decoration:underline;'>"+o.sectionList[0].name+"</a> <a href='addthis' for='"+o.sectionList[1]._id+"' style='text-decoration:underline;'>"+o.sectionList[1].name+"</a> <a href='addthis' for='"+o.sectionList[2]._id+"' style='text-decoration:underline;'>"+o.sectionList[2].name+"</a> <a href='addthis' for='"+o.sectionList[3]._id+"' style='text-decoration:underline;'>"+o.sectionList[3].name)+"</a>";
}
//console.log(section_names);
column.find("ul").append(li);

View File

@ -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