mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-20 12:22:18 -06:00
[IMP] document_url: Visual and functional improvements in UI.
Define the add attachment and add URL buttons on the same line. Allow downloading of url type attachments by clicking on the icon or the name. Define the name of the url type attachments as links (allows to open it in a new tab). Hide the download button for url attachments. Force to set mimetype to "application/link" for url attachments. Displays a link icon for url attachments. TT30263
This commit is contained in:
committed by
FernandoRomera
parent
4aa14473eb
commit
0cb4d31789
@@ -10,6 +10,7 @@ odoo.define("document_url", function (require) {
|
||||
"use strict";
|
||||
|
||||
const AttachmentBox = require("mail/static/src/components/attachment_box/attachment_box.js");
|
||||
const Attachment = require("mail/static/src/components/attachment/attachment.js");
|
||||
const {patch} = require("web.utils");
|
||||
|
||||
patch(AttachmentBox, "document_url", {
|
||||
@@ -30,4 +31,12 @@ odoo.define("document_url", function (require) {
|
||||
this.trigger("reload");
|
||||
},
|
||||
});
|
||||
patch(Attachment, "document_url", {
|
||||
_onClickImage(ev) {
|
||||
if (!this.attachment.isViewable) {
|
||||
this._onClickDownload(ev);
|
||||
}
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
15
document_url/static/src/scss/document_url.scss
Normal file
15
document_url/static/src/scss/document_url.scss
Normal file
@@ -0,0 +1,15 @@
|
||||
.o_AttachmentBox_content {
|
||||
text-align: center;
|
||||
display: block;
|
||||
}
|
||||
.o_AttachmentList_partialListNonImages {
|
||||
.o_Attachment_image {
|
||||
cursor: pointer;
|
||||
}
|
||||
.o_Attachment_filename a {
|
||||
color: #4c4c4c;
|
||||
}
|
||||
}
|
||||
.o_Attachment_url_icon {
|
||||
margin: 4px 2px 0px 4px;
|
||||
}
|
||||
@@ -15,4 +15,33 @@
|
||||
</button>
|
||||
</xpath>
|
||||
</t>
|
||||
<t t-inherit="mail.Attachment" t-inherit-mode="extension" owl="1">
|
||||
<xpath
|
||||
expr="//t[@t-if='attachment']/t/div[1][hasclass('o_Attachment_details')]//div[hasclass('o_Attachment_filename')]/t"
|
||||
position="replace"
|
||||
>
|
||||
<a t-att-href="attachmentUrl" target="new">
|
||||
<t t-esc="attachment.displayName" />
|
||||
</a>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//div[hasclass('o_Attachment_asideItemDownload')]"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="t-if">attachment.mimetype != 'application/link'</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[hasclass('o_Attachment_image')]" position="attributes">
|
||||
<attribute name="t-if">attachment.mimetype != 'application/link'</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[hasclass('o_Attachment_image')]" position="before">
|
||||
<a
|
||||
class="o_Attachment_url_icon"
|
||||
t-att-href="attachmentUrl"
|
||||
target="new"
|
||||
t-if="attachment.mimetype=='application/link'"
|
||||
>
|
||||
<i class="fa fa-link fa-2x" />
|
||||
</a>
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
Reference in New Issue
Block a user