mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-24 14:17:45 -06:00
[MIG] document_url: Migration to 18.0
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import {AttachmentList} from "@mail/core/common/attachment_list";
|
||||
import {Chatter} from "@mail/core/web/chatter";
|
||||
import {ConfirmationDialog} from "@web/core/confirmation_dialog/confirmation_dialog";
|
||||
import {Chatter} from "@mail/chatter/web_portal/chatter";
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
import {useService} from "@web/core/utils/hooks";
|
||||
import {url} from "@web/core/utils/urls";
|
||||
import {_t} from "@web/core/l10n/translation";
|
||||
|
||||
patch(Chatter.prototype, {
|
||||
setup() {
|
||||
super.setup();
|
||||
this.action = useService("action");
|
||||
},
|
||||
_onAddUrl(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@@ -64,4 +71,15 @@ patch(AttachmentList.prototype, {
|
||||
download: true,
|
||||
});
|
||||
},
|
||||
onClickUnlink(attachment) {
|
||||
if (this.env.inComposer) {
|
||||
return this.props.unlinkAttachment(attachment);
|
||||
}
|
||||
this.dialog.add(ConfirmationDialog, {
|
||||
body: _t('Do you really want to delete "%s"?', attachment.name),
|
||||
// eslint-disable-next-line no-empty-function
|
||||
cancel: () => {},
|
||||
confirm: () => this.onConfirmUnlink(attachment),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -29,21 +29,6 @@
|
||||
</xpath>
|
||||
</t>
|
||||
<t t-inherit="mail.AttachmentList" t-inherit-mode="extension">
|
||||
<xpath
|
||||
expr="//div[hasclass('o-mail-AttachmentCard-aside')]//button[@title='Download']"
|
||||
position="after"
|
||||
>
|
||||
<button
|
||||
class="btn d-flex justify-content-center align-items-center w-100 h-100 rounded-0"
|
||||
t-attf-class="bg-300"
|
||||
t-on-click="() => window.open(attachmentUrl, '_blank')"
|
||||
title="Open"
|
||||
t-if="attachment.mimetype === 'application/link'"
|
||||
target="_blank"
|
||||
>
|
||||
<i class="fa fa-link" role="img" aria-label="Open" />
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//div[hasclass('o-mail-AttachmentCard-image')]"
|
||||
position="attributes"
|
||||
|
||||
Reference in New Issue
Block a user