snappymail/dev/Settings/SettingsSocial.js

80 lines
1.9 KiB
JavaScript
Raw Normal View History

2014-08-21 23:08:34 +08:00
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (module) {
'use strict';
var
Utils = require('../Common/Utils.js')
;
/**
* @constructor
*/
function SettingsSocial()
{
var oData = RL.data();
this.googleEnable = oData.googleEnable;
this.googleActions = oData.googleActions;
this.googleLoggined = oData.googleLoggined;
this.googleUserName = oData.googleUserName;
this.facebookEnable = oData.facebookEnable;
this.facebookActions = oData.facebookActions;
this.facebookLoggined = oData.facebookLoggined;
this.facebookUserName = oData.facebookUserName;
this.twitterEnable = oData.twitterEnable;
this.twitterActions = oData.twitterActions;
this.twitterLoggined = oData.twitterLoggined;
this.twitterUserName = oData.twitterUserName;
this.connectGoogle = Utils.createCommand(this, function () {
if (!this.googleLoggined())
{
RL.googleConnect();
}
}, function () {
return !this.googleLoggined() && !this.googleActions();
});
this.disconnectGoogle = Utils.createCommand(this, function () {
RL.googleDisconnect();
});
this.connectFacebook = Utils.createCommand(this, function () {
if (!this.facebookLoggined())
{
RL.facebookConnect();
}
}, function () {
return !this.facebookLoggined() && !this.facebookActions();
});
this.disconnectFacebook = Utils.createCommand(this, function () {
RL.facebookDisconnect();
});
this.connectTwitter = Utils.createCommand(this, function () {
if (!this.twitterLoggined())
{
RL.twitterConnect();
}
}, function () {
return !this.twitterLoggined() && !this.twitterActions();
});
this.disconnectTwitter = Utils.createCommand(this, function () {
RL.twitterDisconnect();
});
}
kn.addSettingsViewModel(SettingsSocial, 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
module.exports = SettingsSocial;
}(module));