Dashboard: use standard button for marking news as read

This commit is contained in:
Michael Panchenko committed 2026-01-11 20:05:19 +07:00
1 parent fac3393e0d
commit f35e10da8c
2 files changed
+25 -22

No files matched your search

+15 -11
View File
@@ -113,23 +113,27 @@ html {
position: absolute;
top: 20px;
right: 20px;
display: flex;
align-items: center;
gap: 8px;
}
.news-mark-read-btn {
background-color: var(--btn-primary);
color: white;
border: none;
padding: 6px 12px;
border-radius: 4px;
cursor: pointer;
font-size: 13px;
color: var(--text-muted);
user-select: none;
transition: background-color 0.3s ease;
white-space: nowrap;
}
.news-mark-read:hover {
color: var(--text-primary);
.news-mark-read-btn:hover {
background-color: var(--btn-hover);
}
.news-mark-read input[type="checkbox"] {
cursor: pointer;
width: 18px;
height: 18px;
.news-mark-read-btn:disabled {
background-color: var(--btn-disabled);
cursor: not-allowed;
}
.news-no-items {
+10 -11
View File
@@ -1927,26 +1927,25 @@ class Dashboard {
url: '/dashboard/news/' + newsId + '.html',
type: 'GET',
success: function(html) {
// Wrap the HTML in a container with a checkbox
// Wrap the HTML in a container with a button
let $newsContainer = $('<div class="news-container">').attr('data-news-id', newsId);
let $newsContent = $(html);
// Add checkbox for marking as read
// Add button for marking as read
let $markRead = $('<div class="news-mark-read">');
let $checkbox = $('<input type="checkbox">').attr('id', 'news-read-' + newsId);
let $label = $('<label>').attr('for', 'news-read-' + newsId).text('Mark as read');
$markRead.append($checkbox).append($label);
let $button = $('<button class="news-mark-read-btn">').attr('data-news-id', newsId).text('Mark as read');
$markRead.append($button);
$newsContent.append($markRead);
$newsContainer.append($newsContent);
self.$newsDisplay.append($newsContainer);
// Bind checkbox event
$checkbox.on('change', function() {
if ($(this).is(':checked')) {
self.markNewsAsRead(newsId);
}
// Bind button click event
$button.on('click', function() {
const btn = $(this);
btn.prop('disabled', true).text('Marking...');
self.markNewsAsRead(newsId);
});
loadedCount++;