[IMP] web: expose sub template of calendar components
Make it easier to override component's sub templates by making them overridable on the component. TaskId-2999194 X-original-commit: 4f4e91ebb14d563dd3ec6d305b9984db25e06cbf Part-of: odoo/odoo#101492
This commit is contained in:
@@ -88,6 +88,11 @@ CalendarCommonPopover.components = {
|
||||
Record,
|
||||
};
|
||||
CalendarCommonPopover.template = "web.CalendarCommonPopover";
|
||||
CalendarCommonPopover.subTemplates = {
|
||||
popover: "web.CalendarCommonPopover.popover",
|
||||
body: "web.CalendarCommonPopover.body",
|
||||
footer: "web.CalendarCommonPopover.footer",
|
||||
};
|
||||
CalendarCommonPopover.props = {
|
||||
close: Function,
|
||||
record: Object,
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<t t-name="web.CalendarCommonPopover" owl="1">
|
||||
<t t-if="env.isSmall">
|
||||
<Dialog title="props.record.title">
|
||||
<t t-call="web.CalendarCommonPopover.body" />
|
||||
<t t-call="{{ constructor.subTemplates.body }}" />
|
||||
<t t-set-slot="footer">
|
||||
<t t-call="web.CalendarCommonPopover.footer" />
|
||||
<t t-call="{{ constructor.subTemplates.footer }}" />
|
||||
</t>
|
||||
</Dialog>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t t-call="web.CalendarCommonPopover.popover" />
|
||||
<t t-call="{{ constructor.subTemplates.popover }}" />
|
||||
</t>
|
||||
</t>
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="o_cw_body">
|
||||
<t t-call="web.CalendarCommonPopover.body" />
|
||||
<t t-call="{{ constructor.subTemplates.body }}" />
|
||||
<div class="card-footer border-top" t-att-class="{ 'o_footer_shrink': isEventEditable and isEventDeletable }">
|
||||
<t t-call="web.CalendarCommonPopover.footer" />
|
||||
<t t-call="{{ constructor.subTemplates.footer }}" />
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
@@ -61,7 +61,7 @@
|
||||
</t>
|
||||
</strong>
|
||||
<div class="flex-grow-1">
|
||||
<Field name="fieldName" record="slot.record" fieldInfo="fieldInfo" />
|
||||
<Field name="fieldName" record="slot.record" fieldInfo="fieldInfo" type="fieldInfo.widget" />
|
||||
</div>
|
||||
</li>
|
||||
</t>
|
||||
|
||||
@@ -80,6 +80,12 @@ export class CalendarYearPopover extends Component {
|
||||
}
|
||||
CalendarYearPopover.components = { Dialog };
|
||||
CalendarYearPopover.template = "web.CalendarYearPopover";
|
||||
CalendarYearPopover.subTemplates = {
|
||||
popover: "web.CalendarYearPopover.popover",
|
||||
body: "web.CalendarYearPopover.body",
|
||||
footer: "web.CalendarYearPopover.footer",
|
||||
record: "web.CalendarYearPopover.record",
|
||||
};
|
||||
CalendarYearPopover.props = {
|
||||
close: Function,
|
||||
date: true,
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<t t-name="web.CalendarYearPopover" owl="1">
|
||||
<t t-if="env.isSmall">
|
||||
<Dialog title="dialogTitle">
|
||||
<t t-call="web.CalendarYearPopover.body" />
|
||||
<t t-call="{{ constructor.subTemplates.body }}" />
|
||||
<t t-set-slot="footer">
|
||||
<t t-call="web.CalendarYearPopover.footer" />
|
||||
<t t-call="{{ constructor.subTemplates.footer }}" />
|
||||
</t>
|
||||
</Dialog>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t t-call="web.CalendarYearPopover.popover" />
|
||||
<t t-call="{{ constructor.subTemplates.popover }}" />
|
||||
</t>
|
||||
</t>
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="o_cw_body">
|
||||
<t t-call="web.CalendarYearPopover.body" />
|
||||
<t t-call="{{ constructor.subTemplates.body }}" />
|
||||
</div>
|
||||
<div t-if="props.model.canCreate" class="mt-2">
|
||||
<t t-call="web.CalendarYearPopover.footer" />
|
||||
<t t-call="{{ constructor.subTemplates.footer }}" />
|
||||
</div>
|
||||
</t>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<t t-foreach="recordGroups" t-as="recordGroup" t-key="recordGroup.title">
|
||||
<div class="fw-bold mt-2" t-esc="recordGroup.title" />
|
||||
<t t-foreach="recordGroup.records" t-as="record" t-key="record.id">
|
||||
<t t-call="web.CalendarYearPopover.record" />
|
||||
<t t-call="{{ constructor.subTemplates.record }}" />
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
@@ -224,3 +224,6 @@ CalendarFilterPanel.components = {
|
||||
Transition,
|
||||
};
|
||||
CalendarFilterPanel.template = "web.CalendarFilterPanel";
|
||||
CalendarFilterPanel.subTemplates = {
|
||||
filter: "web.CalendarFilterPanel.filter",
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<div class="o_calendar_filter_items" t-att-class="transition.className">
|
||||
<t t-foreach="getSortedFilters(section)" t-as="filter" t-key="filter.value">
|
||||
<t t-set="filterId" t-value="nextFilterId" />
|
||||
<t t-call="web.CalendarFilterPanel.filter" />
|
||||
<t t-call="{{ constructor.subTemplates.filter }}" />
|
||||
</t>
|
||||
</div>
|
||||
</Transition>
|
||||
|
||||
Reference in New Issue
Block a user