Skip to content

EspoCRM – Open Source CRM Application

attachment ui impr

Yuri Kuznetsov6d8c89a04124
diff --git a/client/src/views/fields/attachment-multiple.js b/client/src/views/fields/attachment-multiple.js
index 21d7c41438..713a3f1ba8 100644
--- a/client/src/views/fields/attachment-multiple.js
+++ b/client/src/views/fields/attachment-multiple.js
@@ -870,7 +870,7 @@ class AttachmentMultipleFieldView extends BaseFieldView {
' ',
$('<a>')
.attr('href', this.getDownloadUrl(id))
- .attr('target', '_BLANK')
+ .attr('target', '_blank')
.text(name)
)
);
diff --git a/client/src/views/fields/file.js b/client/src/views/fields/file.js
index 0fac10441f..a9d6b03503 100644
--- a/client/src/views/fields/file.js
+++ b/client/src/views/fields/file.js
@@ -467,22 +467,33 @@ class FileFieldView extends LinkFieldView {
.addClass(containerClassName)
.append(
$('<div>')
- .addClass('attachment-block')
+ .addClass('attachment-block attachment-block-preview')
.append($item)
)
.get(0).outerHTML;
}
- return $('<span>')
- .append(
- $('<span>').addClass('fas fa-paperclip text-soft small'),
- ' ',
- $('<a>')
- .attr('href', this.getDownloadUrl(id))
- .attr('target', '_BLANK')
- .text(name)
- )
- .get(0).innerHTML;
+ const container = document.createElement('div');
+ container.classList.add('attachment-block');
+
+ container.append(
+ (() => {
+ const span = document.createElement('span');
+ span.classList.add('fas', 'fa-paperclip', 'text-soft', 'small');
+
+ return span;
+ })(),
+ (() => {
+ const a = document.createElement('a');
+ a.target = '_blank';
+ a.textContent = name;
+ a.href = this.getDownloadUrl(id);
+
+ return a;
+ })(),
+ );
+
+ return container.outerHTML;
}
getImageUrl(id, size) {
diff --git a/frontend/less/espo/custom.less b/frontend/less/espo/custom.less
index 2d0f9cc78a..28b3bf1ab6 100644
--- a/frontend/less/espo/custom.less
+++ b/frontend/less/espo/custom.less
@@ -1984,12 +1984,18 @@ label.attach-file-label {
}
.gray-box .preview {
- overflow: hidden;
overflow-wrap: break-word;
+ max-width: calc(100% - var(--16px));
+ display: inline-block;
a {
color: @text-color;
}
+
+ &:has( > img) {
+ margin-top: var(--3px);
+ margin-bottom: var(--3px);
+ }
}
.attachment-block-container {
@@ -2024,13 +2030,32 @@ label.attach-file-label {
}
.attachment-block {
- display: block;
- vertical-align: top;
- margin-bottom: var(--2px);
-}
+ &:not(.attachment-block-preview) {
+ display: flex;
+ gap: var(--4px);
+ align-items: baseline;
+ overflow: hidden;
+ margin-bottom: var(--2px);
-.attachment-block:last-child {
- margin-bottom: 0;
+ > a {
+ flex: 1;
+ min-width: 0;
+ white-space: normal;
+ word-break: break-word;
+ }
+ }
+
+ &.attachment-block-preview {
+ .attachment-preview {
+ display: block;
+ vertical-align: top;
+ margin-bottom: var(--2px);
+ }
+ }
+
+ &:last-child {
+ margin-bottom: 0;
+ }
}
.list-row > .cell {