Interface redesign (attachments, new preview pane layout)

This commit is contained in:
RainLoop Team 2015-01-04 23:30:07 +04:00
parent 6755a0ce51
commit e3e7c1d963
64 changed files with 1286 additions and 1009 deletions

View file

@ -167,13 +167,21 @@
return Links.attachmentPreview(this.download);
};
/**
* @return {string}
*/
AttachmentModel.prototype.linkThumbnail = function ()
{
return this.hasThumbnail() ? Links.attachmentThumbnailPreview(this.download) : '';
};
/**
* @return {string}
*/
AttachmentModel.prototype.linkThumbnailPreviewStyle = function ()
{
return !this.hasThumbnail() ? '' :
'background:url(' + Links.attachmentThumbnailPreview(this.download) + ')';
var sLink = this.linkThumbnail();
return '' === sLink ? '' : 'background:url(' + sLink + ')';
};
/**
@ -211,7 +219,7 @@
sResult = this.linkFramed();
break;
}
return sResult;
};
@ -253,10 +261,14 @@
return true;
};
AttachmentModel.prototype.iconClass = function ()
/**
* @param {string} sMimeType
* @returns {string}
*/
AttachmentModel.staticIconClassHelper = function (sMimeType)
{
var
aParts = this.mimeType.toLocaleString().split('/'),
aParts = sMimeType.toLocaleString().split('/'),
sClass = 'icon-file'
;
@ -333,6 +345,14 @@
return sClass;
};
/**
* @returns {string}
*/
AttachmentModel.prototype.iconClass = function ()
{
return AttachmentModel.staticIconClassHelper(this.mimeType);
};
module.exports = AttachmentModel;
}());

View file

@ -9,6 +9,8 @@
Utils = require('Common/Utils'),
AttachmentModel = require('Model/Attachment'),
AbstractModel = require('Knoin/AbstractModel')
;
@ -37,17 +39,37 @@
this.size = ko.observable(Utils.isUnd(nSize) ? null : nSize);
this.tempName = ko.observable('');
this.progress = ko.observable('');
this.progress = ko.observable(0);
this.error = ko.observable('');
this.waiting = ko.observable(true);
this.uploading = ko.observable(false);
this.enabled = ko.observable(true);
this.complete = ko.observable(false);
this.progressText = ko.computed(function () {
var iP = this.progress();
return 0 === iP ? '' : '' + (99 === iP ? 100 : iP) + '%';
}, this);
this.progressStyle = ko.computed(function () {
var iP = this.progress();
return 0 === iP ? '' : 'width:' + (99 === iP ? 100 : iP) + '%';
}, this);
this.title = ko.computed(function () {
var sError = this.error();
return '' !== sError ? sError : this.fileName();
}, this);
this.friendlySize = ko.computed(function () {
var mSize = this.size();
return null === mSize ? '' : Utils.friendlySize(this.size());
}, this);
this.mimeType = ko.computed(function () {
return Utils.mimeContentType(this.fileName());
}, this);
this.regDisposables([this.friendlySize]);
}
@ -63,6 +85,7 @@
/**
* @param {AjaxJsonComposeAttachment} oJsonAttachment
* @return {boolean}
*/
ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
{
@ -80,6 +103,15 @@
return bResult;
};
/**
* @return {string}
*/
ComposeAttachmentModel.prototype.iconClass = function ()
{
return AttachmentModel.staticIconClassHelper(this.mimeType());
};
module.exports = ComposeAttachmentModel;
}());