feat: unify page titles
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/promote/production Build is failing

This commit is contained in:
Simon 2026-03-13 19:01:50 +01:00
parent e8ec620d57
commit c933144920
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
37 changed files with 309 additions and 200 deletions

View file

@ -29,7 +29,7 @@ defmodule MvWeb.RoleLive.Form do
{gettext("Back")}
</.button>
</:leading>
{@page_title}
{@content_title}
<:actions>
<.button phx-disable-with={gettext("Saving...")} variant="primary" type="submit">
{gettext("Save")}
@ -94,14 +94,13 @@ defmodule MvWeb.RoleLive.Form do
def mount(params, _session, socket) do
case params["id"] do
nil ->
action = gettext("New")
page_title = action <> " " <> gettext("Role")
content_title = gettext("New") <> " " <> gettext("Role")
{:ok,
socket
|> assign(:return_to, return_to(params["return_to"]))
|> assign(:role, nil)
|> assign(:page_title, page_title)
|> Layouts.assign_page_title(content_title)
|> assign_form()}
id ->
@ -113,14 +112,13 @@ defmodule MvWeb.RoleLive.Form do
actor: socket.assigns[:current_user]
) do
{:ok, role} ->
action = gettext("Edit")
page_title = action <> " " <> gettext("Role")
content_title = gettext("Edit") <> " " <> gettext("Role")
{:ok,
socket
|> assign(:return_to, return_to(params["return_to"]))
|> assign(:role, role)
|> assign(:page_title, page_title)
|> Layouts.assign_page_title(content_title)
|> assign_form()}
{:error, %Ash.Error.Invalid{errors: [%Ash.Error.Query.NotFound{} | _]}} ->

View file

@ -28,7 +28,7 @@ defmodule MvWeb.RoleLive.Index do
{:ok,
socket
|> assign(:page_title, gettext("Listing Roles"))
|> Layouts.assign_page_title(gettext("Roles"))
|> assign(:roles, roles)
|> assign(:user_counts, user_counts)}
end

View file

@ -1,6 +1,6 @@
<Layouts.app flash={@flash} current_user={@current_user}>
<.header>
{gettext("Listing Roles")}
{@content_title}
<:subtitle>
{gettext("Manage roles and their permission sets.")}
</:subtitle>

View file

@ -30,9 +30,11 @@ defmodule MvWeb.RoleLive.Show do
{:ok, role} ->
user_count = load_user_count(role, socket.assigns[:current_user])
content_title = gettext("Role %{name}", name: role.name)
{:ok,
socket
|> assign(:page_title, gettext("Show Role"))
|> Layouts.assign_page_title(content_title)
|> assign(:role, role)
|> assign(:user_count, user_count)
|> assign(:show_delete_modal, false)}
@ -202,7 +204,7 @@ defmodule MvWeb.RoleLive.Show do
{gettext("Back")}
</.button>
</:leading>
{gettext("Role")} {@role.name}
{@content_title}
<:subtitle>{gettext("Role details and permissions.")}</:subtitle>
<:actions>