show delete button only selective

This commit is contained in:
Matthias 2021-11-30 23:22:20 +01:00
parent cefc4af861
commit a653f322b3
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -29,7 +29,7 @@ function updateNotificationTables() {
// this allows the global notification panel to update the tables
window.updateNotifications = updateNotificationTables
function loadNotificationTable(table, options={}) {
function loadNotificationTable(table, options={}, enableDelete=false) {
var params = options.params || {};
var read = typeof(params.read) === 'undefined' ? true : params.read;
@ -90,7 +90,11 @@ function loadNotificationTable(table, options={}) {
{
formatter: function(value, row, index, field) {
var bRead = getReadEditButton(row.pk, row.read)
if (enableDelete) {
var bDel = "<button title='{% trans "Delete Notification" %}' class='notification-delete btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
} else {
var bDel = '';
}
var html = "<div class='btn-group float-right' role='group'>" + bRead + bDel + "</div>";
return html;
}
@ -121,7 +125,7 @@ loadNotificationTable("#history-table", {
name: 'history',
url: '{% url 'api-notifications-list' %}',
no_matches: function() { return '{% trans "No notification history found" %}'; },
});
}, true);
$("#history-refresh").on('click', function() {
$("#history-table").bootstrapTable('refresh');