Merge pull request #615 from Sindrake/forum-topic-background

[ForumTopics] Fix deleted topic row colors
This commit is contained in:
Earlopain 2024-02-14 16:37:36 +01:00 committed by GitHub
commit 5759cc4103
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 12 deletions

View File

@ -137,7 +137,7 @@ ForumPost.hide = function (e) {
dataType: 'json'
}).done(function (data) {
$(`.forum-post[data-forum-post-id="${fpid}"] div.author h4`).append(" (hidden)");
$(`.forum-post[data-forum-post-id="${fpid}"]`).attr('data-is-deleted', 'true');
$(`.forum-post[data-forum-post-id="${fpid}"]`).attr('data-is-hidden', 'true');
}).fail(function (data) {
Utility.error("Failed to hide post.");
});
@ -156,7 +156,7 @@ ForumPost.unhide = function (e) {
}).done(function (data) {
const $author = $(`.forum-post[data-forum-post-id="${fpid}"] div.author h4`);
$author.text($author.text().replace(" (hidden)", ""));
$(`.forum-post[data-forum-post-id="${fpid}"]`).attr('data-is-deleted', 'false');
$(`.forum-post[data-forum-post-id="${fpid}"]`).attr('data-is-hidden', 'false');
}).fail(function (data) {
Utility.error("Failed to unhide post.");
});

View File

@ -14,7 +14,7 @@ div.list-of-forum-posts {
background-color: $forum-post-highlight-background;
}
&[data-is-deleted="true"] {
&[data-is-hidden="true"] {
background-color: $forum-post-hidden-background;
}
@ -62,7 +62,7 @@ div#c-forum-topics {
}
tr.forum-topic-row {
&[data-is-deleted="true"] {
&[data-topic-is-hidden="true"] {
background-color: $forum-topic-hidden-background;
}
@ -77,12 +77,12 @@ div#c-forum-topics {
}
#c-forum-posts #a-index {
tr[data-topic-is-deleted="true"] .forum-post-topic-title::after,
tr[data-is-deleted="true"] .forum-post-excerpt::after {
content: " (deleted)";
tr[data-topic-is-hidden="true"] .forum-post-topic-title::after,
tr[data-is-hidden="true"] .forum-post-excerpt::after {
content: " (hidden)";
color: $forum-topic-except-color;
}
tr[data-is-deleted="true"], tr[data-topic-is-deleted="true"] {
tr[data-is-hidden="true"], tr[data-topic-is-hidden="true"] {
background-color: $forum-topic-hidden-background;
}
}

View File

@ -2,7 +2,7 @@
<article class="forum-post comment-post-grid" id="forum_post_<%= forum_post.id %>"
data-forum-post-id="<%= forum_post.id %>" data-creator="<%= forum_post.creator&.name.downcase %>"
data-creator-id="<%= forum_post.creator_id %>"
data-is-deleted="<%= forum_post.id == original_forum_post_id ? @forum_topic.is_hidden? : forum_post.is_hidden? %>">
data-is-hidden="<%= forum_post.id == original_forum_post_id ? @forum_topic.is_hidden? : forum_post.is_hidden? %>">
<div class="author-info">
<div class="name-rank">
<h4 class="author-name"><%= link_to_user forum_post.creator %></h4>

View File

@ -16,11 +16,9 @@
<tr id="forum-post-<%= forum_post.id %>" data-topic-is-hidden="<%= forum_post.topic.is_hidden? %>" data-is-hidden="<%= forum_post.is_hidden? %>">
<td class="forum-post-topic-title">
<%= link_to forum_post.topic.title, forum_topic_path(forum_post.topic) %>
<%= "(hidden)" if forum_post.topic.is_hidden? %>
</td>
<td class="forum-post-excerpt">
<%= link_to truncate(forum_post.body, :length => 50), forum_post_path(forum_post) %>
<%= "(hidden)" if forum_post.is_hidden? %>
</td>
<td><%= link_to_user forum_post.creator %></td>
<td><%= time_ago_in_words_tagged forum_post.created_at %></td>

View File

@ -9,7 +9,7 @@
</thead>
<tbody>
<% forum_topics.each do |topic| %>
<tr class="forum-topic-row forum-topic-category-<%= topic.category_id %>" data-topic-is-deleted="<%= topic.is_hidden? %>">
<tr class="forum-topic-row forum-topic-category-<%= topic.category_id %>" data-topic-is-hidden="<%= topic.is_hidden? %>">
<td>
<% if topic.is_sticky? %>
<span class="sticky">Sticky:</span>