mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-23 17:08:46 -06:00
[IMP] attachment_preview: fix _onPreviewAttachment and remove class o_attachment_preview
This commit is contained in:
parent
0bce1f3b3b
commit
e7c0e9d1d9
@ -205,12 +205,17 @@ odoo.define("attachment_preview.chatter", function (require) {
|
|||||||
attachment_title,
|
attachment_title,
|
||||||
split_screen
|
split_screen
|
||||||
) {
|
) {
|
||||||
|
if (!canPreview(attachment_extension)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var url = getUrl(
|
var url = getUrl(
|
||||||
attachment_id,
|
attachment_id,
|
||||||
attachment_url,
|
attachment_url,
|
||||||
attachment_extension,
|
attachment_extension,
|
||||||
attachment_title
|
attachment_title
|
||||||
);
|
);
|
||||||
|
|
||||||
if (split_screen) {
|
if (split_screen) {
|
||||||
this.trigger("onAttachmentPreview", {url: url});
|
this.trigger("onAttachmentPreview", {url: url});
|
||||||
} else {
|
} else {
|
||||||
|
@ -242,34 +242,23 @@ odoo.define("attachment_preview.attachment_card", function (require) {
|
|||||||
$target = $(event.currentTarget),
|
$target = $(event.currentTarget),
|
||||||
split_screen = $target.attr("data-target") !== "new",
|
split_screen = $target.attr("data-target") !== "new",
|
||||||
attachment_id = this.attachment.id,
|
attachment_id = this.attachment.id,
|
||||||
attachment_extension = "pdf",
|
|
||||||
attachment_title = this.attachment.filename,
|
attachment_title = this.attachment.filename,
|
||||||
attachment_url = this.attachment.defaultSource;
|
attachment_url = this.attachment.defaultSource;
|
||||||
active_attachment_id = attachment_id;
|
active_attachment_id = attachment_id;
|
||||||
|
|
||||||
if (attachment_extension) {
|
rpc.query({
|
||||||
|
model: "ir.attachment",
|
||||||
|
method: "get_attachment_extension",
|
||||||
|
args: [attachment_id],
|
||||||
|
}).then(function (extension) {
|
||||||
self._showPreview(
|
self._showPreview(
|
||||||
attachment_id,
|
attachment_id,
|
||||||
attachment_url,
|
attachment_url,
|
||||||
attachment_extension,
|
extension,
|
||||||
attachment_title,
|
attachment_title,
|
||||||
split_screen
|
split_screen
|
||||||
);
|
);
|
||||||
} else {
|
});
|
||||||
rpc.query({
|
|
||||||
model: "ir.attachment",
|
|
||||||
method: "get_attachment_extension",
|
|
||||||
args: [attachment_id],
|
|
||||||
}).then(function (extension) {
|
|
||||||
self.showPreview(
|
|
||||||
attachment_id,
|
|
||||||
attachment_url,
|
|
||||||
extension,
|
|
||||||
null,
|
|
||||||
split_screen
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
t-if="attachmentCard.attachment.downloadUrl"
|
t-if="attachmentCard.attachment.downloadUrl"
|
||||||
class="o_AttachmentCard_asideItem d-flex justify-content-center align-items-center ml4 o_attachment_preview"
|
class="o_AttachmentCard_asideItem d-flex justify-content-center align-items-center ml4"
|
||||||
t-att-data-id="attachmentCard.attachment.id"
|
t-att-data-id="attachmentCard.attachment.id"
|
||||||
t-att-data-url="attachmentCard.attachment.defaultSource"
|
t-att-data-url="attachmentCard.attachment.defaultSource"
|
||||||
t-on-click="attachmentCard._onPreviewAttachment"
|
t-on-click="attachmentCard._onPreviewAttachment"
|
||||||
@ -27,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
t-if="attachmentCard.attachment.downloadUrl"
|
t-if="attachmentCard.attachment.downloadUrl"
|
||||||
class="o_AttachmentCard_asideItem d-flex justify-content-center align-items-center ml4 o_attachment_preview o_attachment_preview_new_tab"
|
class="o_AttachmentCard_asideItem d-flex justify-content-center align-items-center ml4 o_attachment_preview_new_tab"
|
||||||
data-target="new"
|
data-target="new"
|
||||||
t-att-data-id="attachmentCard.attachment.id"
|
t-att-data-id="attachmentCard.attachment.id"
|
||||||
t-att-data-url="attachmentCard.attachment.defaultSource"
|
t-att-data-url="attachmentCard.attachment.defaultSource"
|
||||||
|
Loading…
Reference in New Issue
Block a user