mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 14:07:04 +03:00
Added additional account edit form
This commit is contained in:
parent
c6ec3fb311
commit
ebb6a06c65
36 changed files with 149 additions and 59 deletions
|
|
@ -416,6 +416,7 @@
|
|||
'DemoSendMessageError': 750,
|
||||
|
||||
'AccountAlreadyExists': 801,
|
||||
'AccountDoesNotExist': 802,
|
||||
|
||||
'MailServerError': 901,
|
||||
'ClientViewError': 902,
|
||||
|
|
|
|||
|
|
@ -710,6 +710,7 @@
|
|||
oN[Enums.Notification.DemoSendMessageError] = Utils.i18n('NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR');
|
||||
|
||||
oN[Enums.Notification.AccountAlreadyExists] = Utils.i18n('NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS');
|
||||
oN[Enums.Notification.AccountDoesNotExist] = Utils.i18n('NOTIFICATIONS/ACCOUNT_DOES_NOT_EXIST');
|
||||
|
||||
oN[Enums.Notification.MailServerError] = Utils.i18n('NOTIFICATIONS/MAIL_SERVER_ERROR');
|
||||
oN[Enums.Notification.InvalidInputArgument] = Utils.i18n('NOTIFICATIONS/INVALID_INPUT_ARGUMENT');
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
this.deleteAccess = ko.observable(false);
|
||||
this.canBeDalete = ko.observable(Utils.isUnd(bCanBeDelete) ? true : !!bCanBeDelete);
|
||||
this.canBeEdit = this.canBeDalete;
|
||||
}
|
||||
|
||||
_.extend(AccountModel.prototype, AbstractModel.prototype);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,14 @@
|
|||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/AddAccount'));
|
||||
};
|
||||
|
||||
AccountsUserSetting.prototype.editAccount = function (oAccountItem)
|
||||
{
|
||||
if (oAccountItem && oAccountItem.canBeEdit())
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/AddAccount'), [oAccountItem]);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {AccountModel} oAccountToRemove
|
||||
*/
|
||||
|
|
@ -94,6 +102,21 @@
|
|||
}
|
||||
};
|
||||
|
||||
AccountsUserSetting.prototype.onBuild = function (oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.account-item .e-action', function () {
|
||||
var oAccountItem = ko.dataFor(this);
|
||||
if (oAccountItem)
|
||||
{
|
||||
self.editAccount(oAccountItem);
|
||||
}
|
||||
})
|
||||
;
|
||||
};
|
||||
|
||||
module.exports = AccountsUserSetting;
|
||||
|
||||
}());
|
||||
|
|
@ -158,15 +158,17 @@
|
|||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sEmail
|
||||
* @param {string} sLogin
|
||||
* @param {string} sPassword
|
||||
* @param {boolean=} bNew
|
||||
*/
|
||||
RemoteUserStorage.prototype.accountAdd = function (fCallback, sEmail, sLogin, sPassword)
|
||||
RemoteUserStorage.prototype.accountSetup = function (fCallback, sEmail, sPassword, bNew)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AccountAdd', {
|
||||
bNew = Utils.isUnd(bNew) ? true : !!bNew;
|
||||
|
||||
this.defaultRequest(fCallback, 'AccountSetup', {
|
||||
'Email': sEmail,
|
||||
'Login': sLogin,
|
||||
'Password': sPassword
|
||||
'Password': sPassword,
|
||||
'New': bNew ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,12 +26,15 @@
|
|||
word-break: break-all;
|
||||
box-sizing: border-box;
|
||||
line-height: 22px;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
.account-item {
|
||||
|
||||
.e-action {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.button-delete {
|
||||
margin-right: 15px;
|
||||
margin-top: 5px;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
{
|
||||
AbstractView.call(this, 'Popups', 'PopupsAddAccount');
|
||||
|
||||
this.isNew = ko.observable(true);
|
||||
|
||||
this.email = ko.observable('');
|
||||
this.password = ko.observable('');
|
||||
|
||||
|
|
@ -55,10 +57,10 @@
|
|||
|
||||
this.submitRequest(true);
|
||||
|
||||
Remote.accountAdd(_.bind(function (sResult, oData) {
|
||||
Remote.accountSetup(_.bind(function (sResult, oData) {
|
||||
|
||||
this.submitRequest(false);
|
||||
if (Enums.StorageResultType.Success === sResult && oData && 'AccountAdd' === oData.Action)
|
||||
if (Enums.StorageResultType.Success === sResult && oData && 'AccountSetup' === oData.Action)
|
||||
{
|
||||
if (oData.Result)
|
||||
{
|
||||
|
|
@ -75,7 +77,7 @@
|
|||
this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
|
||||
}
|
||||
|
||||
}, this), this.email(), '', this.password());
|
||||
}, this), this.email(), this.password(), this.isNew());
|
||||
|
||||
return true;
|
||||
|
||||
|
|
@ -91,6 +93,8 @@
|
|||
|
||||
AddAccountPopupView.prototype.clearPopup = function ()
|
||||
{
|
||||
this.isNew(true);
|
||||
|
||||
this.email('');
|
||||
this.password('');
|
||||
|
||||
|
|
@ -101,9 +105,14 @@
|
|||
this.submitError('');
|
||||
};
|
||||
|
||||
AddAccountPopupView.prototype.onShow = function ()
|
||||
AddAccountPopupView.prototype.onShow = function (oAccount)
|
||||
{
|
||||
this.clearPopup();
|
||||
if (oAccount && oAccount.canBeEdit())
|
||||
{
|
||||
this.isNew(false);
|
||||
this.email(oAccount.email);
|
||||
}
|
||||
};
|
||||
|
||||
AddAccountPopupView.prototype.onFocus = function ()
|
||||
|
|
|
|||
|
|
@ -104,14 +104,6 @@
|
|||
return !this.submitRequest();
|
||||
});
|
||||
|
||||
this.label = ko.computed(function () {
|
||||
return Utils.i18n('POPUPS_IDENTITIES/' + (this.edit() ? 'TITLE_UPDATE_IDENTITY': 'TITLE_ADD_IDENTITY'));
|
||||
}, this);
|
||||
|
||||
this.button = ko.computed(function () {
|
||||
return Utils.i18n('POPUPS_IDENTITIES/' + (this.edit() ? 'BUTTON_UPDATE_IDENTITY': 'BUTTON_ADD_IDENTITY'));
|
||||
}, this);
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue