smaller read button

This commit is contained in:
Matthias 2021-11-30 22:49:30 +01:00
parent 194c5c5857
commit 679647433a
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -209,8 +209,9 @@ function updateNotificationReadState(btn, panel_caller=false) {
* arguments:
* - pk: primary key of the notification
* - state: current state of the notification (read / unread) -> just pass what you were handed by the api
* - small: should the button be small
**/
function getReadEditButton(pk, state) {
function getReadEditButton(pk, state, small=false) {
if (state) {
var bReadText = '{% trans "Mark as unread" %}';
var bReadIcon = 'fas fa-bookmark icon-red';
@ -220,7 +221,9 @@ function getReadEditButton(pk, state) {
var bReadIcon = 'far fa-bookmark icon-green';
var bReadTarget = 'read';
}
return `<button title='${bReadText}' class='notification-read btn btn-outline-secondary' type='button' pk='${pk}' target='${bReadTarget}'><span class='${bReadIcon}'></span></button>`;
var style = (small) ? 'btn-sm ' : '';
return `<button title='${bReadText}' class='notification-read btn ${style}btn-outline-secondary' type='button' pk='${pk}' target='${bReadTarget}'><span class='${bReadIcon}'></span></button>`;
}
/**
@ -256,7 +259,7 @@ function openNotificationPanel() {
}
html += '<div>';
html += `<span class="text-muted">${item.age_human}</span>`;
html += getReadEditButton(item.pk, item.read);
html += getReadEditButton(item.pk, item.read, true);
html += "</div></li>";
});