git-svn-id: https://msi/svn/firstRepo/WebClient/branches/NewRelease@33 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
+26
-62
@@ -5,14 +5,18 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/sync/syncViewTemplate.
|
||||
//initialize template
|
||||
template: _.template(syncViewTemplate),
|
||||
initialize: function (options) {
|
||||
this.id = "SyncView";
|
||||
SyncView.__super__.initialize.call(this);
|
||||
if (options &&
|
||||
options.tokenFound == 1)
|
||||
options.tokenFound === 1)
|
||||
{
|
||||
this.updateLoginBtn();
|
||||
}
|
||||
window.localStorage.setItem("tryLogin", null);
|
||||
},
|
||||
isStayInPage: function () {
|
||||
return false;
|
||||
},
|
||||
events: {
|
||||
"click #backBtn": "backBtn",
|
||||
"click #fblogin": "fbLogin",
|
||||
@@ -23,7 +27,8 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/sync/syncViewTemplate.
|
||||
e.preventDefault();
|
||||
Profile.setKeySave(null);
|
||||
window.localStorage.setItem("hello", null);
|
||||
Backbone.history.loadUrl();
|
||||
this.updateLoginBtn();
|
||||
//Backbone.history.loadUrl();
|
||||
},
|
||||
backBtn: function (e) {
|
||||
e.preventDefault();
|
||||
@@ -35,91 +40,50 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/sync/syncViewTemplate.
|
||||
|
||||
hello('facebook').login();
|
||||
},
|
||||
fbAfterLogin: function ()
|
||||
{
|
||||
/*
|
||||
var self = this;
|
||||
openFB.api({
|
||||
path: '/me',
|
||||
success: function (data) {
|
||||
Profile.internalLoadProfile(data.id, function(retVal){
|
||||
if(retVal == false)
|
||||
Profile.createProfile(
|
||||
data.id,
|
||||
"fb",
|
||||
data.name,
|
||||
data.email,
|
||||
data.gender,
|
||||
function(){
|
||||
//Backbone.history.loadUrl();
|
||||
});
|
||||
self.updateLoginBtn();
|
||||
});
|
||||
}});
|
||||
*/
|
||||
},
|
||||
gplusLogin: function (e) {
|
||||
var self = this;
|
||||
e.preventDefault();
|
||||
|
||||
hello('google').login();
|
||||
},
|
||||
gPlusAfterLogin: function ()
|
||||
{
|
||||
/*
|
||||
var self = this;
|
||||
openGPlus.api({
|
||||
path: 'people/me',
|
||||
success: function (data) {
|
||||
Profile.internalLoadProfile(data.id, function(retVal){
|
||||
if(retVal == false)
|
||||
Profile.createProfile(
|
||||
data.id,
|
||||
"gplus",
|
||||
data.displayName,
|
||||
data.emails[0].value,
|
||||
data.gender,
|
||||
function(){
|
||||
//Backbone.history.loadUrl();
|
||||
}
|
||||
);
|
||||
self.updateLoginBtn();
|
||||
});
|
||||
}});
|
||||
*/
|
||||
},
|
||||
updateLoginBtn: function ()
|
||||
{
|
||||
if (Profile.isConnected()) {
|
||||
if (Profile.isFbConnected()) {
|
||||
this.$el.find("#fblogin").show();
|
||||
this.$el.find("#gpluslogin").hide();
|
||||
this.$el.find("#fblogin").removeClass("loginfb");
|
||||
this.$el.find("#fblogin").addClass("logoutfb");
|
||||
this.changeBtn("#fblogout", "inline-block!important");
|
||||
this.changeBtn("#gpluslogout", "none");
|
||||
this.changeBtn("#fblogin", "none");
|
||||
this.changeBtn("#gpluslogin", "none");
|
||||
}
|
||||
|
||||
if (Profile.isGPlusConnected()) {
|
||||
this.$el.find("#gpluslogin").show();
|
||||
this.$el.find("#fblogin").hide();
|
||||
this.$el.find("#gpluslogin").removeClass("logingplus");
|
||||
this.$el.find("#gpluslogin").addClass("logoutgplus");
|
||||
this.changeBtn("#fblogout", "none");
|
||||
this.changeBtn("#gpluslogout", "inline-block!important");
|
||||
this.changeBtn("#fblogin", "none");
|
||||
this.changeBtn("#gpluslogin", "none");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.$el.find("#fblogin").removeClass("logoutfb");
|
||||
this.$el.find("#fblogin").addClass("loginfb");
|
||||
this.$el.find("#gpluslogin").removeClass("logoutgplus");
|
||||
this.$el.find("#gpluslogin").addClass("logingplus");
|
||||
this.changeBtn("#fblogout", "none");
|
||||
this.changeBtn("#gpluslogout", "none");
|
||||
this.changeBtn("#fblogin", "inline-block!important");
|
||||
this.changeBtn("#gpluslogin", "inline-block!important");
|
||||
}
|
||||
},
|
||||
changeBtn: function (selector, displayStyle)
|
||||
{
|
||||
var ele = this.$el.find(selector)[0];
|
||||
ele.style.display = "";
|
||||
ele.style.cssText = ele.style.cssText + " display: " + displayStyle + ";";
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
var self = this;
|
||||
//this.header.title = "pippo";
|
||||
SyncView.__super__.render.call(this);
|
||||
|
||||
this.header.$el.append("<a id=\"backBtn\" href=\"\" data-role=\"button\" class=\"ui-btn-right\" data-icon=\"custom\">Indietro</a>");
|
||||
this.header.$el.append("<a id=\"backBtn\" href=\"\" data-role=\"button\" class=\"nav-glyphish-example ui-btn-right ui-btn ui-icon-myHome ui-btn-icon-notext\" data-icon=\"custom\"></a>");
|
||||
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template({app: myManifest}));
|
||||
|
||||
Reference in New Issue
Block a user