Corrected the selector for notification actions (#753).

This commit is contained in:
Alex Tselegidis 2020-05-04 20:45:59 +02:00
parent 08144ceae8
commit 9b924cd3c1

View file

@ -120,7 +120,7 @@ window.Backend = window.Backend || {};
$notification.empty(); $notification.empty();
$('<div/>', { var $instance = $('<div/>', {
'class': 'notification alert', 'class': 'notification alert',
'html': [ 'html': [
$('<button/>', { $('<button/>', {
@ -135,25 +135,20 @@ window.Backend = window.Backend || {};
}), }),
$('<strong/>', { $('<strong/>', {
'html': message 'html': message
}), })
] ]
}) })
.appendTo($notification); .appendTo($notification);
$.each(actions, function (index, action) { actions.forEach(function(action) {
var actionId = action.label.toLowerCase().replace(' ', '-');
$('<button/>', { $('<button/>', {
'id': actionId,
'class': 'btn btn-default btn-xs', 'class': 'btn btn-default btn-xs',
'text': action.label 'text': action.label,
'on': {
'click': action.function
}
}) })
.appendTo($notification); .appendTo($instance);
$(document)
.off('click', '#' + actionId)
.on('click', '#' + actionId, action.function);
}); });
$notification.show('fade'); $notification.show('fade');