Merge pull request #6010 from pratu16x7/show_alert
[alerts] add data-actions in show_alert()
This commit is contained in:
commit
0ad9b4b910
1 changed files with 5 additions and 1 deletions
|
|
@ -265,7 +265,7 @@ frappe.hide_progress = function() {
|
|||
}
|
||||
|
||||
// Floating Message
|
||||
frappe.show_alert = function(message, seconds=7) {
|
||||
frappe.show_alert = function(message, seconds=7, actions={}) {
|
||||
if(typeof message==='string') {
|
||||
message = {
|
||||
message: message
|
||||
|
|
@ -306,6 +306,10 @@ frappe.show_alert = function(message, seconds=7) {
|
|||
return false;
|
||||
});
|
||||
|
||||
Object.keys(actions).map(key => {
|
||||
div.find(`[data-action=${key}]`).on('click', actions[key]);
|
||||
});
|
||||
|
||||
div.delay(seconds * 1000).fadeOut(300);
|
||||
return div;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue