Merge pull request #7445 from Alchez/develop-msgprint-primary-action

feat(core): Allow action on msgprint and throw calls
This commit is contained in:
Rushabh Mehta 2019-05-23 15:01:50 +05:30 committed by GitHub
commit 64a672973d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();