Add Following Tags and Reconfigure Sidebar in Mod Center (#20694)

* reconfigure mod left sidebar, adding following tags

* add localization
This commit is contained in:
Philip How 2024-03-01 12:35:54 +00:00 committed by GitHub
parent c901eb48be
commit fe213a81fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 44 additions and 11 deletions

View file

@ -161,7 +161,20 @@
margin-bottom: 0;
@media (min-width: $breakpoint-m) {
margin-bottom: var(--su-6);
margin-bottom: var(--su-9);
}
hr {
border-top-width: 1px;
border-top-style: solid;
border-top-color: var(--base-20);
color: var(--base-80);
}
.tags-box {
max-height: 12rem;
overflow-y: auto;
margin-bottom: var(--su-2);
}
}

View file

@ -41,6 +41,7 @@ class ModerationsController < ApplicationController
@articles = articles.includes(:user).to_json(JSON_OPTIONS)
@tag = Tag.find_by(name: params[:tag]) || not_found if params[:tag].present?
@current_user_tags = current_user.moderator_for_tags
@current_user_following_tags = current_user.currently_following_tags.pluck(:name) - @current_user_tags
end
def article

View file

@ -4,24 +4,39 @@
</h1>
<nav class="mod-center--nav" aria-label="Mod center inbox navigation">
<h3 class="crayons-subtitle-3 mb-2 pl-2 hidden m:block">
<%= t("views.moderations.aside.inbox") %>
</h3>
<div id="mod-center-inbox" class="mod-center--nav--medium hidden m:block">
<a
href="<%= "#{URL.url}/mod" %>"
class="crayons-link crayons-link--block <%= "crayons-link--current" if @tag.blank? %>"
class="crayons-link crayons-link--block <%= "crayons-link--current" if @tag.blank? %> mb-2"
data-tag-name="All topics">
<%= t("views.moderations.aside.all") %>
</a>
<% if @current_user_tags.any? %>
<% @current_user_tags.each do |tag| %>
<a href="<%= "#{URL.url}/mod/#{tag}" %>" class="crayons-link crayons-link--block <%= "crayons-link--current" if tag == @tag&.name %>" data-tag-name="<%= tag %>">
#<%= tag %>
<span id="<%= tag %>-indicator" class="c-indicator"></span>
</a>
<% end %>
<h3 class="crayons-subtitle-3 mb-2 pl-2 hidden m:block">
<%= t("views.moderations.aside.moderating_tags") %>
</h3>
<div class="tags-box">
<% @current_user_tags.each do |tag| %>
<a href="<%= "#{URL.url}/mod/#{tag}" %>" class="crayons-link crayons-link--block <%= "crayons-link--current" if tag == @tag&.name %>" data-tag-name="<%= tag %>">
#<%= tag %>
<span id="<%= tag %>-indicator" class="c-indicator"></span>
</a>
<% end %>
</div>
<% end %>
<% if @current_user_following_tags.any? %>
<h3 class="crayons-subtitle-3 mb-2 pl-2 hidden m:block">
<%= t("views.moderations.aside.following_tags") %>
</h3>
<div class="tags-box">
<% @current_user_following_tags.each do |tag| %>
<a href="<%= "#{URL.url}/mod/#{tag}" %>" class="crayons-link crayons-link--block <%= "crayons-link--current" if tag == @tag&.name %>" data-tag-name="<%= tag %>">
#<%= tag %>
<span id="<%= tag %>-indicator" class="c-indicator"></span>
</a>
<% end %>
</div>
<% end %>
</div>

View file

@ -181,6 +181,8 @@ en:
tag: Tag Moderation Guide
terms_and_conditions: Terms & Conditions
trusted: Trusted User Guide
following_tags: Following tags
moderating_tags: Moderating tags
author: Author
comments:
view_comment: View Comment

View file

@ -180,6 +180,8 @@ fr:
tag: Guide de modération des étiquettes
terms_and_conditions: Conditions générales d'utilisation
trusted: Guide de l'utilisateur de confiance
following_tags: Following tags
moderating_tags: Moderating tags
author: Auteur
comments:
view_comment: Voir le commentaire