Merge pull request #7445 from Alchez/develop-msgprint-primary-action
feat(core): Allow action on msgprint and throw calls
This commit is contained in:
commit
64a672973d
1 changed files with 11 additions and 0 deletions
|
|
@ -120,6 +120,11 @@ frappe.msgprint = function(msg, title) {
|
|||
}
|
||||
});
|
||||
|
||||
// setup and bind an action to the primary button
|
||||
if (data.primary_action) {
|
||||
frappe.msg_dialog.set_primary_action(__(data.primary_action.label || "Done"), data.primary_action.action);
|
||||
}
|
||||
|
||||
// class "msgprint" is used in tests
|
||||
frappe.msg_dialog.msg_area = $('<div class="msgprint">')
|
||||
.appendTo(frappe.msg_dialog.body);
|
||||
|
|
@ -139,6 +144,12 @@ frappe.msgprint = function(msg, title) {
|
|||
msg = frappe.utils.replace_newlines(data.message);
|
||||
}
|
||||
|
||||
if (data.primary_action) {
|
||||
frappe.msg_dialog.get_primary_btn().show();
|
||||
} else {
|
||||
frappe.msg_dialog.get_primary_btn().hide();
|
||||
}
|
||||
|
||||
var msg_exists = false;
|
||||
if(data.clear) {
|
||||
frappe.msg_dialog.msg_area.empty();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue