[IMP] mail: cleanup naming in attachmentList model
closes odoo/odoo#83557 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
committed by
Sébastien Theys
parent
8c0d28c3db
commit
496c0f0d47
@@ -5,7 +5,7 @@
|
||||
<t t-if="attachmentCard">
|
||||
<div class="o_AttachmentCard d-flex o-has-card-details"
|
||||
t-att-class="{
|
||||
'o-downloadable': !attachmentCard.attachmentList.composerView,
|
||||
'o-downloadable': !attachmentCard.attachmentList.composerViewOwner,
|
||||
'o-isUploading': attachmentCard.attachment.isUploading,
|
||||
'o-viewable': attachmentCard.attachment.isViewable,
|
||||
}" t-att-title="attachmentCard.attachment.displayName ? attachmentCard.attachment.displayName : undefined" t-att-data-id="attachmentCard.attachment.localId"
|
||||
@@ -28,28 +28,28 @@
|
||||
</t>
|
||||
</div>
|
||||
<!-- Attachment aside -->
|
||||
<t t-if="(!attachmentCard.attachmentList.composerView or attachmentCard.attachment.isEditable)">
|
||||
<div class="o_AttachmentCard_aside position-relative overflow-hidden" t-att-class="{ 'o-has-multiple-action d-flex flex-column': !attachmentCard.attachmentList.composerView and attachmentCard.attachment.isEditable }">
|
||||
<t t-if="(!attachmentCard.attachmentList.composerViewOwner or attachmentCard.attachment.isEditable)">
|
||||
<div class="o_AttachmentCard_aside position-relative overflow-hidden" t-att-class="{ 'o-has-multiple-action d-flex flex-column': !attachmentCard.attachmentList.composerViewOwner and attachmentCard.attachment.isEditable }">
|
||||
<!-- Uploading icon -->
|
||||
<t t-if="attachmentCard.attachment.isUploading and attachmentCard.attachmentList.composerView">
|
||||
<t t-if="attachmentCard.attachment.isUploading and attachmentCard.attachmentList.composerViewOwner">
|
||||
<div class="o_AttachmentCard_asideItem o_AttachmentCard_asideItemUploading d-flex justify-content-center align-items-center" title="Uploading">
|
||||
<i class="fa fa-spin fa-spinner"/>
|
||||
</div>
|
||||
</t>
|
||||
<!-- Uploaded icon -->
|
||||
<t t-if="!attachmentCard.attachment.isUploading and attachmentCard.attachmentList.composerView">
|
||||
<t t-if="!attachmentCard.attachment.isUploading and attachmentCard.attachmentList.composerViewOwner">
|
||||
<div class="o_AttachmentCard_asideItem o_AttachmentCard_asideItemUploaded d-flex justify-content-center align-items-center" title="Uploaded">
|
||||
<i class="fa fa-check"/>
|
||||
</div>
|
||||
</t>
|
||||
<!-- Remove button -->
|
||||
<t t-if="attachmentCard.attachment.isEditable">
|
||||
<div class="o_AttachmentCard_asideItem o_AttachmentCard_asideItemUnlink d-flex justify-content-center align-items-center" t-att-class="{ 'o-pretty position-absolute': attachmentCard.attachmentList.composerView }" t-on-click="attachmentCard.onClickUnlink" title="Remove">
|
||||
<div class="o_AttachmentCard_asideItem o_AttachmentCard_asideItemUnlink d-flex justify-content-center align-items-center" t-att-class="{ 'o-pretty position-absolute': attachmentCard.attachmentList.composerViewOwner }" t-on-click="attachmentCard.onClickUnlink" title="Remove">
|
||||
<i class="fa fa-trash"/>
|
||||
</div>
|
||||
</t>
|
||||
<!-- Download button -->
|
||||
<t t-if="!attachmentCard.attachmentList.composerView and !attachmentCard.attachment.isUploading">
|
||||
<t t-if="!attachmentCard.attachmentList.composerViewOwner and !attachmentCard.attachment.isUploading">
|
||||
<div class="o_AttachmentCard_asideItem o_AttachmentCard_asideItemDownload d-flex justify-content-center align-items-center" t-on-click="attachmentCard.attachment.onClickDownload" title="Download">
|
||||
<i class="fa fa-download"/>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<t t-if="attachmentImage.attachment.isEditable">
|
||||
<div class="o_AttachmentImage_imageOverlay text-right p-2 text-white opacity-0 opacity-100-hover">
|
||||
<div class="o_AttachmentImage_action o_AttachmentImage_actionUnlink btn btn-sm btn-dark rounded opacity-75 opacity-100-hover"
|
||||
t-att-class="{'o-pretty': attachmentImage.attachmentList.composerView}" t-on-click="attachmentImage.onClickUnlink" title="Remove"
|
||||
t-att-class="{'o-pretty': attachmentImage.attachmentList.composerViewOwner}" t-on-click="attachmentImage.onClickUnlink" title="Remove"
|
||||
>
|
||||
<i class="fa fa-trash"/>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@ registerModel({
|
||||
if (!this.attachment) {
|
||||
return;
|
||||
}
|
||||
if (this.attachmentList.composerView) {
|
||||
if (this.attachmentList.composerViewOwner) {
|
||||
this.component.trigger('o-attachment-removed', { attachmentLocalId: this.attachment.localId });
|
||||
this.attachment.remove();
|
||||
} else {
|
||||
|
||||
@@ -30,7 +30,7 @@ registerModel({
|
||||
if (!this.attachment) {
|
||||
return;
|
||||
}
|
||||
if (this.attachmentList.composerView) {
|
||||
if (this.attachmentList.composerViewOwner) {
|
||||
this.component.trigger('o-attachment-removed', { attachmentLocalId: this.attachment.localId });
|
||||
this.attachment.remove();
|
||||
} else {
|
||||
@@ -45,13 +45,13 @@ registerModel({
|
||||
if (!this.attachmentList) {
|
||||
return clear();
|
||||
}
|
||||
if (this.attachmentList.composerView) {
|
||||
if (this.attachmentList.composerViewOwner) {
|
||||
return 50;
|
||||
}
|
||||
if (this.attachmentList.attachmentBoxViewOwner) {
|
||||
return 160;
|
||||
}
|
||||
if (this.attachmentList.message) {
|
||||
if (this.attachmentList.messageViewOwner) {
|
||||
return 300;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@ import { clear, insertAndReplace, replace } from '@mail/model/model_field_comman
|
||||
|
||||
registerModel({
|
||||
name: 'AttachmentList',
|
||||
identifyingFields: [['composerView', 'messageView', 'attachmentBoxViewOwner']],
|
||||
identifyingFields: [['composerViewOwner', 'messageViewOwner', 'attachmentBoxViewOwner']],
|
||||
recordMethods: {
|
||||
/**
|
||||
* Select the next attachment.
|
||||
@@ -39,17 +39,17 @@ registerModel({
|
||||
}));
|
||||
},
|
||||
/**
|
||||
* @returns {Attachment[]}
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeAttachments() {
|
||||
if (this.message) {
|
||||
return replace(this.message.attachments);
|
||||
if (this.messageViewOwner) {
|
||||
return replace(this.messageViewOwner.message.attachments);
|
||||
}
|
||||
if (this.attachmentBoxViewOwner) {
|
||||
return replace(this.attachmentBoxViewOwner.chatter.thread.allAttachments);
|
||||
}
|
||||
if (this.composerView && this.composerView.composer) {
|
||||
return replace(this.composerView.composer.attachments);
|
||||
if (this.composerViewOwner && this.composerViewOwner.composer) {
|
||||
return replace(this.composerViewOwner.composer.attachments);
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -110,7 +110,7 @@ registerModel({
|
||||
/**
|
||||
* Link with a composer view to handle attachments.
|
||||
*/
|
||||
composerView: one('ComposerView', {
|
||||
composerViewOwner: one('ComposerView', {
|
||||
inverse: 'attachmentList',
|
||||
readonly: true,
|
||||
}),
|
||||
@@ -120,13 +120,10 @@ registerModel({
|
||||
imageAttachments: many('Attachment', {
|
||||
compute: '_computeImageAttachments',
|
||||
}),
|
||||
message: one('Message', {
|
||||
related: 'messageView.message'
|
||||
}),
|
||||
/**
|
||||
* Link with a message view to handle attachments.
|
||||
*/
|
||||
messageView: one('MessageView', {
|
||||
messageViewOwner: one('MessageView', {
|
||||
inverse: 'attachmentList',
|
||||
readonly: true,
|
||||
}),
|
||||
|
||||
@@ -205,7 +205,7 @@ registerModel({
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @param {MouseEvent} ev
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
onClickEmoji(ev) {
|
||||
if (this.textInputComponent) {
|
||||
@@ -924,7 +924,7 @@ registerModel({
|
||||
*/
|
||||
attachmentList: one('AttachmentList', {
|
||||
compute: '_computeAttachmentList',
|
||||
inverse: 'composerView',
|
||||
inverse: 'composerViewOwner',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
|
||||
@@ -143,7 +143,7 @@ registerModel({
|
||||
*/
|
||||
attachmentList: one('AttachmentList', {
|
||||
compute: '_computeAttachmentList',
|
||||
inverse: 'messageView',
|
||||
inverse: 'messageViewOwner',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user