[IMP] web: controlpanel selection-actions slot

Selecting records in a list view will trigger the display of UI elements
that will allow users to manage the selection and run actions on the
selected records.

Prior to this commit, this UI section was displayed within the
'additional actions' slot of the CP, but for UI consistency when
switching to/from mobile view (where the searchbar is usually hidden),
a new slot for 'selection-actions' is added to the control panel, in the
same place as the searchbar (indeed the searchbar is hidden when a
selection occurs, so sharing the same space seems like a good idea as it
avoids clipping/overflow issues)

Part-of: odoo/odoo#116641
This commit is contained in:
Damien Bouvy
2023-05-12 22:59:19 +02:00
committed by Pierre Paridans
parent 4b21d735f9
commit 05b10edc02
2 changed files with 11 additions and 20 deletions
@@ -34,8 +34,9 @@
<span class="d-none d-xl-block me-auto"/> <!-- Spacer -->
</div>
<div t-if="display.layoutActions" class="o_control_panel_actions d-empty-none d-flex align-items-center justify-content-around order-2 order-lg-1 w-100 w-lg-auto">
<t t-slot="layout-actions"/>
<div class="o_control_panel_actions d-empty-none d-flex align-items-center justify-content-start order-2 order-lg-1 w-100 w-lg-auto">
<t t-if="display.layoutActions" t-slot="layout-actions"/>
<t t-slot="control-panel-selection-actions"/>
</div>
<div class="o_control_panel_navigation d-flex flex-wrap flex-md-nowrap align-items-center justify-content-end gap-3 gap-lg-1 gap-xl-3 order-1 order-lg-2 flex-grow-1">
@@ -36,7 +36,14 @@
</t>
<t t-set-slot="control-panel-additional-actions">
<div t-if="nbSelected" class="d-flex ms-3 gap-1">
<CogMenu t-if="!nbSelected">
<DropdownItem t-if="nbTotal and !nbSelected and activeActions.exportXlsx and isExportEnable" onSelected.bind="onDirectExportData">
Export All
</DropdownItem>
</CogMenu>
</t>
<t t-set-slot="control-panel-selection-actions">
<div t-if="nbSelected" class="d-flex gap-1">
<t t-call="web.ListView.Selection"/>
<t t-foreach="archInfo.headerButtons" t-as="button" t-key="button.id">
<MultiRecordViewButton
@@ -62,23 +69,6 @@
onActionExecuted="() => model.load()"/>
</t>
</div>
<t t-else="">
<CogMenu>
<DropdownItem t-if="nbTotal and !nbSelected and activeActions.exportXlsx and isExportEnable" onSelected.bind="onDirectExportData">
Export All
</DropdownItem>
<t t-if="props.info.actionMenus">
<ActionMenusItems
getActiveIds="() => model.root.selection.map((r) => r.resId)"
context="props.context"
domain="props.domain"
items="actionMenuItems"
isDomainSelected="model.root.isDomainSelected"
resModel="model.root.resModel"
onActionExecuted="() => model.load()"/>
</t>
</CogMenu>
</t>
</t>
<t t-component="props.Renderer" list="model.root" activeActions="activeActions" archInfo="archInfo" allowSelectors="props.allowSelectors" editable="editable" openRecord.bind="openRecord" noContentHelp="props.info.noContentHelp" onAdd.bind="createRecord"/>
</Layout>