This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/views/basic_infos/index.html.erb

61 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

2013-11-25 12:24:56 +00:00
<%= stylesheet_link_tag "sign_up" %>
<section id="main-wrap">
<div class="sign-up have-other-sign-in facebook-form">
2013-11-25 12:24:56 +00:00
<div class="form">
<h3 class="login-logo">Please select a method for Basic Info</h3>
<div class="option-block">
2013-11-26 11:14:24 +00:00
<a href="<%= basic_infos_form_path(:user_id=>@user.id.to_s) %>" class="btn btn-info btn-large">Form</a>
2013-11-25 12:24:56 +00:00
<div class="or">
<div class="line left"></div>
<span>OR</span>
<div class="line right"></div>
</div>
2013-11-25 17:00:51 +00:00
<a href="javascript:void(0);" class="facebook"><img src="assets/facebook-logo.png" /></a>
2013-11-25 12:24:56 +00:00
</div>
2013-11-26 11:14:24 +00:00
<div class="option-block msg alert hide"><h4></h4><br /><a href="<%= basic_infos_role_page_path(:user_id => @user.id.to_s) %>" class="btn btn-primary hide">Next</a></div>
2013-11-25 12:24:56 +00:00
</div>
</div>
</section>
2013-11-25 17:00:51 +00:00
<script type="text/javascript">
(function(){
var facebookWindow = null,
timeInterval = null;
$("a.facebook").click(function(){
2013-11-29 11:35:39 +00:00
facebookWindow = window.open('<%= facebook_server_path(:user_id=>@user.id.to_s) %>','login_window','height=668,width=1124,titlebar=0,statusbar=0,location=0');
2013-11-26 11:14:24 +00:00
clearInterval(timeInterval);
2013-11-25 17:00:51 +00:00
timeInterval = setInterval(function(){
if( facebookWindow.closed ){
clearInterval(timeInterval);
$(".msg").removeClass('hide alert-danger').find("h4").text("Importing,please wait...");
2013-11-26 11:14:24 +00:00
$.ajax({
url : "/facebook/profile_import",
data : {"user_id":"<%= @user.id.to_s %>"},
type : "get",
dataType : "json",
success : function(data){
if(!data.success){
$(".msg").removeClass('hide').addClass('alert-danger').find("h4").text(data.message);
}else{
var msg = "";
if (data.user.first_name){
msg+= "Welcome " + data.user.first_name + ", your data is successfully imported!"
}else{
msg = "Import Succesfull!"
}
$(".msg").removeClass('hide').addClass('alert-success').find("h4").text(msg);
$(".msg a").removeClass('hide');
}
},
error : function(){
$(".msg").removeClass('hide').addClass('alert-danger').find("h4").text("Error connecting the server!");
2013-11-25 17:00:51 +00:00
}
})
}
},1000);
})
})()
</script>