Interface optimization

Mark as important (compose)
This commit is contained in:
RainLoop Team 2014-12-31 16:21:43 +04:00
parent 821991a263
commit d5eacb6a4d
43 changed files with 1069 additions and 780 deletions

View file

@ -304,7 +304,7 @@
'EqualTo': 'EqualTo',
'NotEqualTo': 'NotEqualTo'
};
/**
* @enum {string}
*/

View file

@ -23,6 +23,8 @@
this.enabled = ko.observable(true);
this.id = '';
this.name = ko.observable('');
this.name.error = ko.observable(false);
this.name.focused = ko.observable(false);
@ -33,6 +35,7 @@
// Actions
this.actionValue = ko.observable('');
this.actionMarkAsRead = ko.observable(false);
this.actionSkipOthers = ko.observable(false);
this.actionType = ko.observable(Enums.FiltersAction.Move);
@ -74,18 +77,27 @@
_.extend(FilterModel.prototype, AbstractModel.prototype);
FilterModel.prototype.generateID = function ()
{
this.id = Utils.fakeMd5();
};
FilterModel.prototype.toJson = function ()
{
return {
'ID': this.id,
'Enabled': this.enabled(),
'Name': this.name(),
'ConditionsType': this.conditionsType(),
'Conditions': _.map(this.conditions(), function (oItem) {
return oItem.toJson();
}),
'ActionMarkAsRead': this.actionMarkAsRead(),
'ActionValue': this.actionValue(),
'ActionType': this.actionType()
'ActionType': this.actionType(),
'MarkAsRead': this.actionMarkAsRead() ? '1' : '0',
'SkipOthers': this.actionSkipOthers() ? '1' : '0'
};
};
@ -105,6 +117,7 @@
var bResult = false;
if (oItem && 'Object/Filter' === oItem['@Object'])
{
this.ID = Utils.pString(oItem['ID']);
this.name(Utils.pString(oItem['Name']));
bResult = true;
@ -117,6 +130,8 @@
{
var oClone = new FilterModel();
oClone.ID = this.ID;
oClone.enabled(this.enabled());
oClone.name(this.name());
@ -125,6 +140,8 @@
oClone.conditionsType(this.conditionsType());
oClone.actionMarkAsRead(this.actionMarkAsRead());
oClone.actionSkipOthers(this.actionSkipOthers());
oClone.actionValue(this.actionValue());
oClone.actionType(this.actionType());

View file

@ -13,7 +13,6 @@
;
/**
* @param {*} oKoList
* @constructor
*/
function FilterConditionModel()

File diff suppressed because it is too large Load diff

View file

@ -44,7 +44,7 @@
{'toggleSubscribeProperty': [this, 'deleteAccess']});
this.saveChanges = Utils.createCommand(this, function () {
if (!this.filters.saving())
{
this.filters.saving(true);
@ -70,8 +70,8 @@
});
this.filters.subscribe(function () {
this.haveChanges(true);
}, this);
this.haveChanges(true);
}, this);
}
FiltersUserSettings.prototype.scrollableOptions = function ()
@ -105,6 +105,7 @@
oNew = new FilterModel()
;
oNew.generateID();
require('Knoin/Knoin').showScreenPopup(
require('View/Popup/Filter'), [oNew, function () {
self.filters.push(oNew);

View file

@ -493,9 +493,10 @@
* @param {(Array|null)} aDraftInfo
* @param {string} sInReplyTo
* @param {string} sReferences
* @param {boolean} bMarkAsImportant
*/
RemoteUserStorage.prototype.saveMessage = function (fCallback, sMessageFolder, sMessageUid, sDraftFolder,
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences)
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences, bMarkAsImportant)
{
this.defaultRequest(fCallback, 'SaveMessage', {
'MessageFolder': sMessageFolder,
@ -511,6 +512,7 @@
'DraftInfo': aDraftInfo,
'InReplyTo': sInReplyTo,
'References': sReferences,
'MarkAsImportant': bMarkAsImportant ? '1' : '0',
'Attachments': aAttachments
}, Consts.Defaults.SaveMessageAjaxTimeout);
};
@ -552,9 +554,11 @@
* @param {string} sInReplyTo
* @param {string} sReferences
* @param {boolean} bRequestReadReceipt
* @param {boolean} bMarkAsImportant
*/
RemoteUserStorage.prototype.sendMessage = function (fCallback, sMessageFolder, sMessageUid, sSentFolder,
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences, bRequestReadReceipt)
sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences,
bRequestReadReceipt, bMarkAsImportant)
{
this.defaultRequest(fCallback, 'SendMessage', {
'MessageFolder': sMessageFolder,
@ -571,6 +575,7 @@
'InReplyTo': sInReplyTo,
'References': sReferences,
'ReadReceiptRequest': bRequestReadReceipt ? '1' : '0',
'MarkAsImportant': bMarkAsImportant ? '1' : '0',
'Attachments': aAttachments
}, Consts.Defaults.SendMessageAjaxTimeout);
};

View file

@ -47,6 +47,8 @@
this.bCapaAdditionalIdentities = Settings.capa(Enums.Capa.AdditionalIdentities);
this.allowContacts = !!Settings.settingsGet('ContactsIsAllowed');
var
self = this,
fCcAndBccCheckHelper = function (aValue) {
@ -76,6 +78,7 @@
this.isHtml = ko.observable(false);
this.requestReadReceipt = ko.observable(false);
this.markAsImportant = ko.observable(false);
this.sendError = ko.observable(false);
this.sendSuccessButSaveError = ko.observable(false);
@ -298,7 +301,8 @@
this.aDraftInfo,
this.sInReplyTo,
this.sReferences,
this.requestReadReceipt()
this.requestReadReceipt(),
this.markAsImportant()
);
}
}
@ -334,7 +338,8 @@
this.prepearAttachmentsForSendOrSave(),
this.aDraftInfo,
this.sInReplyTo,
this.sReferences
this.sReferences,
this.markAsImportant()
);
}
@ -354,6 +359,21 @@
}, this.canBeSendedOrSaved);
this.contactsCommand = Utils.createCommand(this, function () {
if (this.allowContacts)
{
this.skipCommand();
_.delay(function () {
kn.showScreenPopup(require('View/Popup/Contacts'), [true]);
}, 200);
}
}, function () {
return this.allowContacts;
});
Events.sub('interval.2m', function () {
if (this.modalVisibility() && !Data.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
@ -800,6 +820,10 @@
self.initOnShow(sType, oMessageOrArray, aToEmails, sCustomSubject, sCustomPlainText);
}, null, null, null, false]);
}
else if (aToEmails && 0 < aToEmails.length)
{
this.addEmailsToTo(aToEmails);
}
}
else
{
@ -807,6 +831,23 @@
}
};
/**
* @param {Array} aEmails
*/
ComposePopupView.prototype.addEmailsToTo = function (aEmails)
{
var
sTo = Utils.trim(this.to()),
aTo = []
;
aTo = _.uniq(_.compact(_.map(aEmails, function (oItem) {
return oItem ? oItem.toLine(false) : null;
})));
this.to(sTo + ('' === sTo ? '' : ', ') + Utils.trim(aTo.join(', ')));
};
/**
* @param {string=} sType = Enums.ComposeType.Empty
* @param {?MessageModel|Array=} oMessageOrArray = null
@ -1826,6 +1867,7 @@
this.subject('');
this.requestReadReceipt(false);
this.markAsImportant(false);
this.aDraftInfo = null;
this.sInReplyTo = '';

View file

@ -46,6 +46,8 @@
}
;
this.bBackToCompose = false;
this.allowContactsSync = Data.allowContactsSync;
this.enableContactsSync = Data.enableContactsSync;
this.allowExport = !Globals.bMobileDevice;
@ -261,8 +263,13 @@
if (Utils.isNonEmptyArray(aE))
{
self.bBackToCompose = false;
kn.hideScreenPopup(require('View/Popup/Contacts'));
kn.showScreenPopup(require('View/Popup/Compose'), [Enums.ComposeType.Empty, null, aE]);
_.delay(function () {
kn.showScreenPopup(require('View/Popup/Compose'), [Enums.ComposeType.Empty, null, aE]);
}, 200);
}
}, function () {
@ -716,8 +723,10 @@
this.initUploader();
};
ContactsPopupView.prototype.onShow = function ()
ContactsPopupView.prototype.onShow = function (bBackToCompose)
{
this.bBackToCompose = Utils.isUnd(bBackToCompose) ? false : !!bBackToCompose;
kn.routeOff();
this.reloadContactList(true);
};
@ -732,6 +741,13 @@
Utils.delegateRunOnDestroy(this.contacts());
this.contacts([]);
if (this.bBackToCompose)
{
this.bBackToCompose = false;
kn.showScreenPopup(require('View/Popup/Compose'));
}
};
module.exports = ContactsPopupView;

View file

@ -165,6 +165,7 @@
this.viewDownloadLink = ko.observable('');
this.viewUserPic = ko.observable(Consts.DataImages.UserDotPic);
this.viewUserPicVisible = ko.observable(false);
this.viewIsImportant = ko.observable(false);
this.viewPgpPassword = ko.observable('');
this.viewPgpSignedVerifyStatus = ko.computed(function () {
@ -202,6 +203,7 @@
this.viewLineAsCcc(oMessage.lineAsCcc());
this.viewViewLink(oMessage.viewLink());
this.viewDownloadLink(oMessage.downloadLink());
this.viewIsImportant(oMessage.isImportant());
sLastEmail = oMessage.fromAsSingleEmail();
Cache.getUserPic(sLastEmail, function (sPic, $sEmail) {