diff --git a/frontend/client/src/views/fields/file.js b/frontend/client/src/views/fields/file.js
index 96d2edad06..717f840aab 100644
--- a/frontend/client/src/views/fields/file.js
+++ b/frontend/client/src/views/fields/file.js
@@ -30,21 +30,21 @@ Espo.define('Views.Fields.File', 'Views.Fields.Link', function (Dep) {
detailTemplate: 'fields.file.detail',
editTemplate: 'fields.file.edit',
-
+
showPreview: false,
-
+
accept: false,
-
+
previewTypeList: [
'image/jpeg',
'image/png',
'image/gif',
],
-
+
defaultType: false,
-
+
previewSize: 'small',
-
+
events: {
'click a.remove-attachment': function (e) {
var $div = $(e.currentTarget).parent();
@@ -71,7 +71,7 @@ Espo.define('Views.Fields.File', 'Views.Fields.Link', function (Dep) {
},
'click a[data-action="showImagePreview"]': function (e) {
e.preventDefault();
-
+
var id = this.model.get(this.idName);
this.createView('preview', 'Modals.ImagePreview', {
id: id,
@@ -89,7 +89,7 @@ Espo.define('Views.Fields.File', 'Views.Fields.Link', function (Dep) {
acceptAttribue: this.acceptAttribue
}, Dep.prototype.data.call(this));
},
-
+
validateRequired: function () {
if (this.params.required || this.model.isRequired(this.name)) {
if (this.model.get(this.idName) == null) {
@@ -105,21 +105,21 @@ Espo.define('Views.Fields.File', 'Views.Fields.Link', function (Dep) {
this.idName = this.name + 'Id';
this.typeName = this.name + 'Type';
this.foreignScope = 'Attachment';
-
+
if ('showPreview' in this.params) {
this.showPreview = this.params.showPreview;
}
-
+
if ('accept' in this.params) {
this.accept = this.params.accept;
}
-
+
if (this.accept) {
this.acceptAttribue = this.accept.join('|');
}
-
+
},
-
+
afterRender: function () {
if (this.mode == 'edit') {
this.$attachment = this.$el.find('div.attachment');
@@ -132,10 +132,10 @@ Espo.define('Views.Fields.File', 'Views.Fields.Link', function (Dep) {
}
}
},
-
+
getDetailPreview: function (name, type, id) {
var preview = name;
-
+
switch (type) {
case 'image/png':
case 'image/jpeg':
@@ -144,17 +144,17 @@ Espo.define('Views.Fields.File', 'Views.Fields.Link', function (Dep) {
}
return preview;
},
-
+
getEditPreview: function (name, type, id) {
var preview = name;
-
+
switch (type) {
case 'image/png':
case 'image/jpeg':
case 'image/gif':
preview = '';
}
-
+
return preview;
},
@@ -163,13 +163,13 @@ Espo.define('Views.Fields.File', 'Views.Fields.Link', function (Dep) {
var name = this.model.get(this.nameName);
var type = this.model.get(this.typeName) || this.defaultType;
var id = this.model.get(this.idName);
-
+
if (!id) {
return false;
}
-
+
var string = '';
-
+
if (this.showPreview && ~this.previewTypeList.indexOf(type)) {
string = '