snappymail/dev/Settings/Identity.js

53 lines
1.3 KiB
JavaScript
Raw Normal View History

/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
*/
2013-11-19 06:29:13 +08:00
function SettingsIdentity()
{
var oData = RL.data();
this.displayName = oData.displayName;
this.signature = oData.signature;
2013-11-19 06:29:13 +08:00
this.replyTo = oData.replyTo;
2013-11-19 06:29:13 +08:00
this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
}
2013-11-19 06:29:13 +08:00
Utils.addSettingsViewModel(SettingsIdentity, 'SettingsIdentity', 'SETTINGS_LABELS/LABEL_IDENTITY_NAME', 'identity');
2013-11-19 06:29:13 +08:00
SettingsIdentity.prototype.onBuild = function ()
{
var self = this;
_.delay(function () {
var
oData = RL.data(),
2013-11-19 06:29:13 +08:00
f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self)
;
oData.displayName.subscribe(function (sValue) {
RL.remote().saveSettings(f1, {
'DisplayName': sValue
});
});
oData.replyTo.subscribe(function (sValue) {
RL.remote().saveSettings(f2, {
'ReplyTo': sValue
});
});
oData.signature.subscribe(function (sValue) {
RL.remote().saveSettings(f3, {
'Signature': sValue
});
});
}, 50);
};