CommonJS (research/3)

This commit is contained in:
RainLoop Team 2014-08-22 19:08:56 +04:00
parent 586abbb802
commit 06bb124379
99 changed files with 51037 additions and 42961 deletions

View file

@ -6,11 +6,13 @@
var
_ = require('../External/underscore.js'),
ko = require('./External/ko.js'),
ko = require('../External/ko.js'),
$window = require('../External/$window.js'),
Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js')
Utils = require('../Common/Utils.js'),
Events = require('../Common/Events.js')
;
/**
@ -42,18 +44,7 @@
this.actionBlink = ko.observable(false).extend({'falseTimeout': 1000});
this.nameForEdit = ko.observable('');
this.name.subscribe(function (sValue) {
this.nameForEdit(sValue);
}, this);
this.edited.subscribe(function (bValue) {
if (bValue)
{
this.nameForEdit(this.name());
}
}, this);
this.privateMessageCountAll = ko.observable(0);
this.privateMessageCountUnread = ko.observable(0);
@ -150,11 +141,6 @@
iType = this.type()
;
if (Enums.FolderType.Inbox === iType)
{
RL.data().foldersInboxUnreadCount(iUnread); // TODO cjs
}
if (0 < iCount)
{
if (Enums.FolderType.Draft === iType)
@ -290,6 +276,25 @@
});
}, this);
// subscribe
this.name.subscribe(function (sValue) {
this.nameForEdit(sValue);
}, this);
this.edited.subscribe(function (bValue) {
if (bValue)
{
this.nameForEdit(this.name());
}
}, this);
this.messageCountUnread.subscribe(function (iUnread) {
if (Enums.FolderType.Inbox === this.type())
{
Events.pub('mailbox.inbox-unread-count', [iUnread]);
}
}, this);
return this;
};