Merge pull request #38533 from KerollesFathy/feat/frappe-confirm-custom-labels
feat: Add `primary_label` and `secondary_label` params to frappe.confirm
This commit is contained in:
commit
11a9eba342
1 changed files with 9 additions and 3 deletions
|
|
@ -26,15 +26,21 @@ frappe.throw = function (msg) {
|
|||
throw new Error(msg.message);
|
||||
};
|
||||
|
||||
frappe.confirm = function (message, confirm_action, reject_action) {
|
||||
frappe.confirm = function (
|
||||
message,
|
||||
confirm_action,
|
||||
reject_action,
|
||||
primary_label,
|
||||
secondary_label
|
||||
) {
|
||||
var d = new frappe.ui.Dialog({
|
||||
title: __("Confirm", null, "Title of confirmation dialog"),
|
||||
primary_action_label: __("Yes", null, "Approve confirmation dialog"),
|
||||
primary_action_label: __(primary_label || "Yes", null, "Approve confirmation dialog"),
|
||||
primary_action: () => {
|
||||
confirm_action && confirm_action();
|
||||
d.hide();
|
||||
},
|
||||
secondary_action_label: __("No", null, "Dismiss confirmation dialog"),
|
||||
secondary_action_label: __(secondary_label || "No", null, "Dismiss confirmation dialog"),
|
||||
secondary_action: () => d.hide(),
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue