[IMP] web: ConfirmationDialog buttons' name

This commit adds two props for the `ConfirmationDialog`:
`cancelLabel` and `confirmLabel`.
Both are `String` and optional and the buttons will remain named "Ok"
and "Cancel" by default.

Part-of: odoo/odoo#97314
This commit is contained in:
svs-odoo
2022-08-30 09:23:09 +02:00
parent f4407fd38a
commit cb19ad1995
2 changed files with 8 additions and 12 deletions
@@ -34,9 +34,13 @@ ConfirmationDialog.props = {
},
body: String,
confirm: { type: Function, optional: true },
confirmLabel: { type: String, optional: true },
cancel: { type: Function, optional: true },
cancelLabel: { type: String, optional: true },
};
ConfirmationDialog.defaultProps = {
confirmLabel: _lt("Ok"),
cancelLabel: _lt("Cancel"),
title: _lt("Confirmation"),
};
@@ -5,12 +5,8 @@
<Dialog size="'md'" title="props.title">
<t t-esc="props.body" />
<t t-set-slot="footer" owl="1">
<button class="btn btn-primary" t-on-click="_confirm">
Ok
</button>
<button t-if="props.cancel" class="btn btn-secondary" t-on-click="_cancel">
Cancel
</button>
<button class="btn btn-primary" t-on-click="_confirm" t-esc="props.confirmLabel"/>
<button t-if="props.cancel" class="btn btn-secondary" t-on-click="_cancel" t-esc="props.cancelLabel"/>
</t>
</Dialog>
</t>
@@ -19,12 +15,8 @@
<Dialog size="'sm'" title="props.title" contentClass="props.contentClass">
<t t-esc="props.body" />
<t t-set-slot="footer" owl="1">
<button class="btn btn-primary" t-on-click="_confirm">
Ok
</button>
<button t-if="props.cancel" class="btn btn-secondary" t-on-click="_cancel">
Cancel
</button>
<button class="btn btn-primary" t-on-click="_confirm" t-esc="props.confirmLabel"/>
<button t-if="props.cancel" class="btn btn-secondary" t-on-click="_cancel" t-esc="props.cancelLabel"/>
</t>
</Dialog>
</t>