This commit is contained in:
RainLoop Team 2015-03-19 01:26:52 +04:00
parent d8c9f7ec14
commit 16d2f46a31
7 changed files with 51 additions and 38 deletions

View file

@ -47,6 +47,9 @@
this.attachmentsClass = '';
};
/**
* @return {string}
*/
MessageFullModel.prototype.getAttachmentsClass = function ()
{
var sClass = '';
@ -81,23 +84,25 @@
{
var bResult = false;
if (oJson && 'Object/Message' === oJson['@Object'] &&
MessageSimpleModel.prototype.initByJson.call(this, oJson))
if (oJson && 'Object/Message' === oJson['@Object'])
{
this.priority = Utils.pInt(oJson.Priority);
this.priority = Utils.inArray(this.priority, [Enums.MessagePriority.High, Enums.MessagePriority.Low]) ?
this.priority : Enums.MessagePriority.Normal;
if (MessageSimpleModel.prototype.initByJson.call(this, oJson))
{
this.priority = Utils.pInt(oJson.Priority);
this.priority = Utils.inArray(this.priority, [Enums.MessagePriority.High, Enums.MessagePriority.Low]) ?
this.priority : Enums.MessagePriority.Normal;
this.hash = Utils.pString(oJson.Hash);
this.requestHash = Utils.pString(oJson.RequestHash);
this.hash = Utils.pString(oJson.Hash);
this.requestHash = Utils.pString(oJson.RequestHash);
this.proxy = !!oJson.ExternalProxy;
this.proxy = !!oJson.ExternalProxy;
this.hasAttachments = !!oJson.HasAttachments;
this.attachmentsMainType = Utils.pString(oJson.AttachmentsMainType);
this.attachmentsClass = this.getAttachmentsClass();
this.hasAttachments = !!oJson.HasAttachments;
this.attachmentsMainType = Utils.pString(oJson.AttachmentsMainType);
this.attachmentsClass = this.getAttachmentsClass();
bResult = true;
bResult = true;
}
}
return bResult;

View file

@ -7,20 +7,20 @@
_ = require('_'),
ko = require('ko'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
// Enums = require('Common/Enums'),
// Utils = require('Common/Utils'),
//
// MessageHelper = require('Helper/Message'),
MessageHelper = require('Helper/Message'),
MessageSimpleModel = require('Model/MessageSimple')
AbstractModel = require('Knoin/AbstractModel')
;
/**
* @constructor
*/
function MessageDynamicModel()
function MessageStatesModel()
{
MessageSimpleModel.call(this, 'MessageDynamicModel');
AbstractModel.call(this, 'MessageStatesModel');
this.flags = {};
this.states = {};
@ -39,15 +39,18 @@
this.states.showReadReceipt = ko.observable(false);
this.states.showExternalImages = ko.observable(false);
this.states.hasUnseenSubMessage = ko.observable(false);
this.states.hasFlaggedSubMessage = ko.observable(false);
this.states.hasUnseenSubMessages = ko.observable(false);
this.states.hasFlaggedSubMessages = ko.observable(false);
this.threads = ko.observableArray([]);
}
_.extend(MessageDynamicModel.prototype, MessageSimpleModel.prototype);
_.extend(MessageStatesModel.prototype, AbstractModel.prototype);
MessageDynamicModel.prototype.clear = function ()
MessageStatesModel.prototype.flags = {};
MessageStatesModel.prototype.states = {};
MessageStatesModel.prototype.clear = function ()
{
this.flags.unseen(false);
this.flags.deleted(false);
@ -58,6 +61,6 @@
this.threads([]);
};
module.exports = MessageDynamicModel;
module.exports = MessageStatesModel;
}());

View file

@ -182,19 +182,23 @@
.b-attachment-place {
position: absolute;
height: 120px;
left: 5px;
right: 5px;
top: 5px;
bottom: 5px;
border: 2px #777 dashed;
z-index: 300;
line-height: 119px;
text-align: center;
background-color: #fff;
z-index: 300;
left: 20px;
right: 20px;
background-color: #efefef;
font-size: 24px;
&.drag-and-drop-over {
background: #777;
color: #fff;
border-radius: 10px;
&.dragAndDropOver {
background-color: #fff;
}
}
}

View file

@ -1609,6 +1609,7 @@
this.dragAndDropOver(false);
}, this))
.on('onBodyDragEnter', _.bind(function () {
this.attachmentsPlace(true);
this.dragAndDropVisible(true);
}, this))
.on('onBodyDragLeave', _.bind(function () {