second commit for harry.tp

This commit is contained in:
Harry Bomrah 2013-11-26 01:00:51 +08:00 committed by saurabhbhatia
parent 12127a8d6c
commit 73b82bc177
6 changed files with 38 additions and 6 deletions

View File

@ -32,14 +32,19 @@
.sign-up .or .left{ .sign-up .or .left{
margin-top: 10px; margin-top: 10px;
width: 220px; margin-left: 60px;
width: 160px;
float: left; float: left;
} }
.sign-up .or .right{ .sign-up .or .right{
margin-top: 10px; margin-top: 10px;
width: 220px; margin-right: 60px;
width: 160px;
float: right; float: right;
} }
.sign-up .facebook:hover{
opacity: 0.8;
}
.line{ .line{
border-bottom: 1px solid #EDEDED; border-bottom: 1px solid #EDEDED;

View File

@ -1,7 +1,6 @@
class BasicInfosController < ApplicationController class BasicInfosController < ApplicationController
layout "devise" layout "devise"
def index def index
@url = "http://fb.tp.rulingcom.com/login?callback=http://harry.tp.rulingcom.com/facebook/register_fb?user="+current_user.id.to_s rescue nil
end end
def form_page def form_page

View File

@ -43,4 +43,8 @@ class FacebookController< ApplicationController
render :json=>{"success"=>true}.to_json render :json=>{"success"=>true}.to_json
end end
def server_redirect
# "http://fb.tp.rulingcom.com/login?callback=http://harry.tp.rulingcom.com/facebook/register_fb?user="+current_user.id.to_s rescue nil
redirect_to "http://new.tp.rulingcom.com"
end
end end

View File

@ -10,9 +10,33 @@
<span>OR</span> <span>OR</span>
<div class="line right"></div> <div class="line right"></div>
</div> </div>
<a href="#" onclick="window.open('<%= @url %>','login_window','height=668,width=1124,titlebar=0,statusbar=0,location=0');return false;"><img src="assets/facebook-logo.png" /></a> <a href="javascript:void(0);" class="facebook"><img src="assets/facebook-logo.png" /></a>
</div> </div>
<div class="option-block msg"></div>
</div> </div>
</div> </div>
</section> </section>
<script type="text/javascript">
(function(){
var facebookWindow = null,
timeInterval = null;
$("a.facebook").click(function(){
facebookWindow = window.open('<%= facebook_server_path %>','login_window','height=668,width=1124,titlebar=0,statusbar=0,location=0');
timeInterval = setInterval(function(){
if( facebookWindow.closed ){
clearInterval(timeInterval);
$.getJSON("/facebook/get_friends",function(data){
if(!data.success){
$(".msg").text(data.message);
}else{
$(".msg").text("Import Succesfull!");
}
})
}
},1000);
})
})()
</script>

View File

@ -1,6 +1,6 @@
<div id="connection_setting" class="overview vp" content-layout="simple"> <div id="connection_setting" class="overview vp" content-layout="simple">
<a href="" onclick="window.open('<%= @url %>','login_window','height=250,width=400,titlebar=0,statusbar=0,location=0');return false;">Connect FaceBook</a> <a href="" onclick="window.open('<%= facebook_server_path %>','login_window','height=250,width=400,titlebar=0,statusbar=0,location=0');return false;">Connect FaceBook</a>
<a href="/facebook/get_friends" ajax-remote="get" >Get Friends</a> <a href="/facebook/get_friends" ajax-remote="get" >Get Friends</a>
<a href="/facebook/disconnect" ajax-remote="get" >Disconnect from facebook</a> <a href="/facebook/disconnect" ajax-remote="get" >Disconnect from facebook</a>

View File

@ -320,7 +320,7 @@ Orbit::Application.routes.draw do
match "/facebook/register_fb" => "facebook#register_fb" match "/facebook/register_fb" => "facebook#register_fb"
match "/facebook/get_friends" => "facebook#get_friends" match "/facebook/get_friends" => "facebook#get_friends"
match "/facebook/disconnect" => "facebook#disconnect" match "/facebook/disconnect" => "facebook#disconnect"
match "/facebook/server" => "facebook#server_redirect"
match "/desktop/wallpaper_upload" => "desktop#wallpaper_upload" match "/desktop/wallpaper_upload" => "desktop#wallpaper_upload"
#match '/desktop_orbit/eventajaxload' => 'desktop_publications#create_journal' #match '/desktop_orbit/eventajaxload' => 'desktop_publications#create_journal'