Promises (first look)

Thread dropdown
Small fixes
This commit is contained in:
RainLoop Team 2015-03-14 03:10:00 +04:00
parent dd41d30f9b
commit c23ba31e17
61 changed files with 12442 additions and 130 deletions

View file

@ -29,6 +29,8 @@
Local = require('Storage/Client'),
Remote = require('Remote/User/Ajax'),
Promises = require('Promises/User/Ajax'),
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView')
;
@ -73,6 +75,8 @@
this.fullScreenMode = MessageStore.messageFullScreenMode;
this.messageListOfThreadsLoading = Promises.messageListSimple.loading;
this.lastReplyAction_ = ko.observable('');
this.lastReplyAction = ko.computed({
read: this.lastReplyAction_,
@ -205,9 +209,11 @@
// THREADS
this.viewThreads = ko.observableArray([]);
this.viewThreadMessages = ko.observableArray([]);
this.viewThreads.trigger = ko.observable(false);
this.viewThreadMessages = ko.observableArray([]);
this.viewThreadMessages.hash = '';
MessageStore.messageLastThreadUidsData.subscribe(function (oData) {
if (oData && oData['Uids'])
{
@ -290,14 +296,39 @@
}, this.viewThreadsControlForwardAllow);
this.threadListCommand = Utils.createCommand(this, function () {
var aList = [], aStatus = this.viewThreads.status();
var
self = this,
sFolder = this.viewFolder,
sUid = this.viewUid,
aUids = this.viewThreads(),
aStatus = this.viewThreads.status()
;
if (aStatus && aStatus[0])
{
this.viewThreadMessages(aList);
// window.console.log(aStatus);
self.viewThreadMessages([]);
Promises.messageListSimple(sFolder, aUids).then(function (aList) {
_.each(aList, function (oItem) {
if (oItem && oItem.uid)
{
oItem.selected(sUid === oItem.uid);
}
});
self.viewThreadMessages(aList);
}, function (iErrorCode) {
window.alert(Translator.getNotification(iErrorCode));
});
}
}, function () {
return !this.messageLoadingThrottle();
return !this.messageLoadingThrottle() &&
!this.messageListOfThreadsLoading();
});
// PGP
@ -675,6 +706,13 @@
oEvent.stopPropagation();
}
})
.on('click', '.thread-list .thread-list-message', function () {
var oMessage = ko.dataFor(this);
if (oMessage && oMessage.folderFullNameRaw && oMessage.uid)
{
self.openThreadMessage(oMessage.uid);
}
})
.on('click', '.attachmentsPlace .attachmentItem .attachmentNameParent', function () {
var