[IMP] mail: MessageActionList, adapt padding and items order

Since ChatWindow messages can be aligned in both directions, the
MessageActionList must adapt its padding and the order of its items when
the menu is expanded according to the message.

This commit adapts the padding and the order of the items.

closes odoo/odoo#98607

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Brieuc-brd
2022-08-23 13:38:28 +02:00
parent 3e67492d8e
commit 61c32b8578
2 changed files with 21 additions and 3 deletions
@@ -2,7 +2,7 @@
<templates>
<t t-name="mail.MessageActionList" owl="1">
<t t-if="messageActionList">
<div class="o_MessageActionList d-flex rounded-1 bg-white shadow-sm" t-att-class="{ 'o-isDeviceSmall': messaging.device.isSmall }" t-attf-class="{{ className }}" t-ref="root">
<div class="o_MessageActionList d-flex rounded-1 bg-white shadow-sm" t-att-class="{ 'o-isDeviceSmall': messaging.device.isSmall, 'flex-row-reverse': messageActionList.messageView.isInChatWindowAndIsAlignedRight }" t-attf-class="{{ className }}" t-ref="root">
<t t-foreach="messageActionList.messageActionViews" t-as="messageActionView" t-key="messageActionView.localId">
<MessageActionView record="messageActionView"/>
</t>
@@ -104,12 +104,30 @@ registerModel({
_computePaddingClassNames() {
const isDeviceSmall = this.messaging.device.isSmall;
const paddingClassNames = [];
if (this.messageAction.messageActionListOwner.firstActionView === this) {
if (
(
this.messageAction.messageActionListOwner.firstActionView === this &&
!this.messageAction.messageActionListOwner.messageView.isInChatWindowAndIsAlignedRight
) ||
(
this.messageAction.messageActionListOwner.lastActionView === this &&
this.messageAction.messageActionListOwner.messageView.isInChatWindowAndIsAlignedRight
)
) {
paddingClassNames.push(isDeviceSmall ? 'ps-3' : 'ps-2');
} else {
paddingClassNames.push(isDeviceSmall ? 'ps-2' : 'ps-1');
}
if (this.messageAction.messageActionListOwner.lastActionView === this) {
if (
(
this.messageAction.messageActionListOwner.lastActionView === this &&
!this.messageAction.messageActionListOwner.messageView.isInChatWindowAndIsAlignedRight
) ||
(
this.messageAction.messageActionListOwner.firstActionView === this &&
this.messageAction.messageActionListOwner.messageView.isInChatWindowAndIsAlignedRight
)
) {
paddingClassNames.push(isDeviceSmall ? 'pe-3' : 'pe-2');
} else {
paddingClassNames.push(isDeviceSmall ? 'pe-2' : 'pe-1');