Add a proper title to moderation index pages

Since this is already a component, we can use the `header` method
without much refactoring.
This commit is contained in:
Javi Martín
2024-04-12 01:29:38 +02:00
parent 75598972e3
commit 26a43ee0d2
4 changed files with 12 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
<h2><%= t("moderation.#{i18n_namespace}.index.title") %></h2> <%= header %>
<%= render "shared/filter_subnav", i18n_namespace: "moderation.#{i18n_namespace}.index" %> <%= render "shared/filter_subnav", i18n_namespace: "moderation.#{i18n_namespace}.index" %>

View File

@@ -1,4 +1,5 @@
class Moderation::Shared::IndexComponent < ApplicationComponent class Moderation::Shared::IndexComponent < ApplicationComponent
include Header
attr_reader :records attr_reader :records
def initialize(records) def initialize(records)
@@ -7,6 +8,10 @@ class Moderation::Shared::IndexComponent < ApplicationComponent
private private
def title
t("moderation.#{i18n_namespace}.index.title")
end
def i18n_namespace def i18n_namespace
table_name table_name
end end

View File

@@ -1,6 +1,6 @@
<% provide :main_class, "moderation-users-index" %> <% provide :main_class, "moderation-users-index" %>
<h2><%= t("moderation.users.index.title") %></h2> <%= header %>
<%= render Admin::SearchComponent.new(label: t("moderation.users.index.search_placeholder")) %> <%= render Admin::SearchComponent.new(label: t("moderation.users.index.search_placeholder")) %>

View File

@@ -1,4 +1,5 @@
class Moderation::Users::IndexComponent < ApplicationComponent class Moderation::Users::IndexComponent < ApplicationComponent
include Header
attr_reader :users attr_reader :users
def initialize(users) def initialize(users)
@@ -7,6 +8,10 @@ class Moderation::Users::IndexComponent < ApplicationComponent
private private
def title
t("moderation.users.index.title")
end
def status(user) def status(user)
t("admin.activity.show.actions.#{activity_action(user)}") t("admin.activity.show.actions.#{activity_action(user)}")
end end