feat: unify page titles
This commit is contained in:
parent
e8ec620d57
commit
c933144920
37 changed files with 309 additions and 200 deletions
22
lib/mv_web/plugs/assign_club_name.ex
Normal file
22
lib/mv_web/plugs/assign_club_name.ex
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
defmodule MvWeb.Plugs.AssignClubName do
|
||||
@moduledoc """
|
||||
Assigns :club_name from settings for controller-rendered pages.
|
||||
Used by the root layout to build the browser tab title (Mila · Club · Page).
|
||||
LiveViews set club_name in on_mount instead.
|
||||
"""
|
||||
import Plug.Conn
|
||||
|
||||
alias Mv.Membership
|
||||
|
||||
def init(opts), do: opts
|
||||
|
||||
def call(conn, _opts) do
|
||||
club_name =
|
||||
case Membership.get_settings() do
|
||||
{:ok, settings} when is_binary(settings.club_name) -> settings.club_name
|
||||
_ -> nil
|
||||
end
|
||||
|
||||
assign(conn, :club_name, club_name)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue