[IMP] mail: move hasAttachmentViewer in community

This reduces the need for overrides in enterprise.

Part of task-2871070

Part-of: odoo/odoo#95085
This commit is contained in:
Sébastien Theys
2022-07-01 20:41:40 +02:00
parent 8bb675ffa5
commit 779175fd42
7 changed files with 58 additions and 1 deletions
@@ -133,6 +133,10 @@ Object.assign(ChatterContainer, {
type: Boolean,
optional: true,
},
isInFormSheetBg: {
type: Boolean,
optional: true,
},
threadId: {
type: Number,
optional: true,
@@ -0,0 +1,3 @@
.o_ChatterContainer.o-isInFormSheetBg {
max-width: $o-form-view-sheet-max-width;
}
@@ -2,7 +2,7 @@
<templates xml:space="preserve">
<t t-name="mail.ChatterContainer" owl="1">
<div class="o_ChatterContainer flex-grow-1 d-flex w-100" t-attf-class="{{ className }}" data-command-category="mail" t-ref="root">
<div class="o_ChatterContainer flex-grow-1 d-flex w-100" t-att-class="{ 'o-isInFormSheetBg mx-auto': props.isInFormSheetBg }" t-attf-class="{{ className }}" data-command-category="mail" t-ref="root">
<t t-if="chatter">
<Chatter record="chatter"/>
</t>
+3
View File
@@ -439,6 +439,9 @@ registerModel({
compute: '_computeIsDisabled',
default: false,
}),
isInFormSheetBg: attr({
default: false,
}),
isPreparingAttachmentsLoading: attr({
compute: '_computeIsPreparingAttachmentsLoading',
default: false,
@@ -1,2 +1,4 @@
// Variable definitions that depend on bootstrap variables
$o-mail-thread-window-zindex: $zindex-modal + 1 !default;
// Side chatter
$o-chatter-min-width: 530px !default;
@@ -110,6 +110,12 @@ FormRenderer.include({
// Mail Methods
//--------------------------------------------------------------------------
/**
* @returns {boolean}
*/
hasAttachmentViewer() {
return false;
},
/**
* @private
* @returns {boolean}
@@ -133,6 +139,7 @@ FormRenderer.include({
hasParentReloadOnFollowersUpdate: this.chatterFields.hasRecordReloadOnFollowersUpdate,
hasParentReloadOnMessagePosted: this.chatterFields.hasRecordReloadOnMessagePosted,
isAttachmentBoxVisibleInitially: this.chatterFields.isAttachmentBoxVisibleInitially,
isInFormSheetBg: this.hasAttachmentViewer(),
threadId: this.state.res_id,
threadModel: this.state.model,
};
@@ -162,6 +169,11 @@ FormRenderer.include({
} else {
$(this._chatterContainerTarget).removeClass('o-aside');
}
if (this.hasAttachmentViewer()) {
this._chatterContainerTarget.classList.add('o-isInFormSheetBg');
} else {
this._chatterContainerTarget.classList.remove('o-isInFormSheetBg');
}
},
/**
* @abstract
@@ -2,6 +2,39 @@
// Layout
// ------------------------------------------------------------------
.o_FormRenderer_chatterContainer {
&.o-aside {
border-left: $border-width solid;
padding: map-get($spacers, 0);
width: $o-chatter-min-width;
.o_Message.o-not-discussion {
border-width: $border-width 0;
}
}
&.o-isInFormSheetBg:not(.o-aside) {
max-width: none;
background-color: $white;
@include o-form-sheet-negative-margin;
&:not(.o-aside) {
width: auto;
border-top: 1px solid $border-color;
}
}
}
// ------------------------------------------------------------------
// Style
// ------------------------------------------------------------------
.o_FormRenderer_chatterContainer.o-aside {
border-left-color: $border-color;
}
.o_FormRenderer_chatterContainer {
display: flex;
flex: 1 1 auto;