[IMP] web: ConfirmationDialog can take a confirmClass props

Before this commit, the confirm button of the confirmation dialog
was always btn-primary.

After this commit, it can take a props to modify that.

Part-of: odoo/odoo#126963
This commit is contained in:
Lucas Perais
2023-07-12 03:48:48 +02:00
parent 884a56c239
commit 49ae7f4d47
2 changed files with 4 additions and 2 deletions
@@ -68,12 +68,14 @@ ConfirmationDialog.props = {
body: String,
confirm: { type: Function, optional: true },
confirmLabel: { type: String, optional: true },
confirmClass: { type: String, optional: true },
cancel: { type: Function, optional: true },
cancelLabel: { type: String, optional: true },
};
ConfirmationDialog.defaultProps = {
confirmLabel: _lt("Ok"),
cancelLabel: _lt("Cancel"),
confirmClass: "btn-primary",
title: _lt("Confirmation"),
};
@@ -5,7 +5,7 @@
<Dialog size="'md'" title="props.title" modalRef="modalRef">
<p t-out="props.body" class="text-prewrap"/>
<t t-set-slot="footer" owl="1">
<button class="btn btn-primary" t-on-click="_confirm" t-esc="props.confirmLabel"/>
<button class="btn" t-att-class="props.confirmClass" 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>
@@ -15,7 +15,7 @@
<Dialog size="'sm'" title="props.title" contentClass="props.contentClass">
<p t-out="props.body" class="text-prewrap"/>
<t t-set-slot="footer" owl="1">
<button class="btn btn-primary" t-on-click="_confirm" t-esc="props.confirmLabel"/>
<button class="btn" t-att-class="props.confirmClass" 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>