Identities redesign

This commit is contained in:
RainLoop Team 2013-11-19 02:29:13 +04:00
parent df1c369a9d
commit 44241b859c
22 changed files with 267 additions and 183 deletions

View file

@ -579,7 +579,7 @@ RainLoopApp.prototype.bootstart = function ()
if (this.settingsGet('AllowIdentities'))
{
Utils.removeSettingsViewModel(SettingsPersonal);
Utils.removeSettingsViewModel(SettingsIdentity);
}
else
{

View file

@ -7,12 +7,16 @@ function SettingsIdentities()
{
var oData = RL.data();
this.displayName = oData.displayName;
this.signature = oData.signature;
this.replyTo = oData.replyTo;
this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.identities = oData.identities;
this.legent = ko.computed(function () {
return Utils.i18n('SETTINGS_IDENTITIES/LEGEND_IDENTITIES_FOR', {'EMAIL': oData.accountEmail()});
}, this);
this.processText = ko.computed(function () {
return oData.identitiesLoading() ? Utils.i18n('SETTINGS_IDENTITIES/LOADING_PROCESS') : '';
}, this);
@ -34,9 +38,6 @@ function SettingsIdentities()
}
}
]});
this.signature = oData.signature;
this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
}
Utils.addSettingsViewModel(SettingsIdentities, 'SettingsIdentities', 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'identities');
@ -52,7 +53,6 @@ SettingsIdentities.prototype.editIdentity = function (oIdentity)
};
/**
*
* @param {IdentityModel} oIdentityToRemove
*/
SettingsIdentities.prototype.deleteIdentity = function (oIdentityToRemove)
@ -96,11 +96,25 @@ SettingsIdentities.prototype.onBuild = function (oDom)
var
oData = RL.data(),
f1 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self)
f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self)
;
oData.signature.subscribe(function (sValue) {
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
});
});

View file

@ -3,29 +3,29 @@
/**
* @constructor
*/
function SettingsPersonal()
function SettingsIdentity()
{
var oData = RL.data();
this.displayName = oData.displayName;
this.replyTo = oData.replyTo;
this.signature = oData.signature;
this.replyTo = oData.replyTo;
this.nameTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
}
Utils.addSettingsViewModel(SettingsPersonal, 'SettingsPersonal', 'SETTINGS_LABELS/LABEL_PERSONAL_NAME', 'personal');
Utils.addSettingsViewModel(SettingsIdentity, 'SettingsIdentity', 'SETTINGS_LABELS/LABEL_IDENTITY_NAME', 'identity');
SettingsPersonal.prototype.onBuild = function ()
SettingsIdentity.prototype.onBuild = function ()
{
var self = this;
_.delay(function () {
var
oData = RL.data(),
f1 = Utils.settingsSaveHelperSimpleFunction(self.nameTrigger, self),
f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self)
;

View file

@ -61,9 +61,9 @@
@import "AdminPlugin.less";
@import "Activate.less";
@import "Settings.less";
@import "SettingsPersonal.less";
@import "SettingsGeneral.less";
@import "SettingsAccounts.less";
@import "SettingsIdentity.less";
@import "SettingsIdentities.less";
@import "SettingsFolders.less";
@import "SettingsThemes.less";

View file

@ -0,0 +1,4 @@
.b-settings-identity {
}

View file

@ -1,4 +0,0 @@
.b-settings-personal {
}

View file

@ -19,6 +19,7 @@ function PopupsComposeViewModel()
var
self = this,
oRainLoopData = RL.data(),
fEmailArrayToStringLineHelper = function (aList) {
var
@ -112,12 +113,21 @@ function PopupsComposeViewModel()
this.currentIdentityResultEmail = ko.observable('');
this.identitiesOptions = ko.computed(function () {
return _.map(RL.data().identities(), function (oItem) {
return {
var aList = [{
'optValue': oRainLoopData.accountEmail(),
'optText': this.formattedFrom(false)
}];
_.each(oRainLoopData.identities(), function (oItem) {
aList.push({
'optValue': oItem.id,
'optText': oItem.formattedNameForCompose()
};
});
});
return aList;
}, this);
ko.computed(function () {
@ -130,7 +140,7 @@ function PopupsComposeViewModel()
sID = this.currentIdentityID()
;
if (this.bAllowIdentities && sID)
if (this.bAllowIdentities && sID && sID !== RL.data().accountEmail())
{
oItem = _.find(aList, function (oItem) {
return oItem && sID === oItem['id'];
@ -142,9 +152,11 @@ function PopupsComposeViewModel()
if ('' === sResult && aList[0])
{
this.currentIdentityID(aList[0]['id']);
return '';
}
}
else
if ('' === sResult)
{
sResult = this.formattedFrom(false);
sResultEmail = this.formattedFrom(true);
@ -427,10 +439,8 @@ PopupsComposeViewModel.prototype.findIdentityIdByMessage = function (sComposeTyp
oIDs[oItem.email()] = oItem['id'];
});
}
else
{
oIDs[RL.data().accountEmail()] = RL.data().accountEmail();
}
oIDs[RL.data().accountEmail()] = RL.data().accountEmail();
switch (sComposeType)
{