From 2fa8f3eb2c783f1ef4bd4199d10a32b95eee2a87 Mon Sep 17 00:00:00 2001 From: carla Date: Mon, 15 Dec 2025 08:50:42 +0100 Subject: [PATCH] fix: update clubname on save --- lib/mv_web/components/layouts.ex | 6 +++++- lib/mv_web/components/layouts/navbar.ex | 9 ++++++--- lib/mv_web/live/global_settings_live.ex | 9 ++++++--- mix.lock | 8 ++++---- .../index_custom_fields_accessibility_test.exs | 9 ++++++++- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/lib/mv_web/components/layouts.ex b/lib/mv_web/components/layouts.ex index 487a01f..86090a8 100644 --- a/lib/mv_web/components/layouts.ex +++ b/lib/mv_web/components/layouts.ex @@ -36,12 +36,16 @@ defmodule MvWeb.Layouts do default: nil, doc: "the current [scope](https://hexdocs.pm/phoenix/scopes.html)" + attr :club_name, :string, + default: nil, + doc: "optional club name to pass to navbar" + slot :inner_block, required: true def app(assigns) do ~H""" <%= if @current_user do %> - <.navbar current_user={@current_user} /> + <.navbar current_user={@current_user} club_name={@club_name} /> <% end %>
diff --git a/lib/mv_web/components/layouts/navbar.ex b/lib/mv_web/components/layouts/navbar.ex index 4246c99..1ff589b 100644 --- a/lib/mv_web/components/layouts/navbar.ex +++ b/lib/mv_web/components/layouts/navbar.ex @@ -12,15 +12,18 @@ defmodule MvWeb.Layouts.Navbar do required: true, doc: "The current user - navbar is only shown when user is present" - def navbar(assigns) do - club_name = get_club_name() + attr :club_name, :string, + default: nil, + doc: "Optional club name - if not provided, will be loaded from database" + def navbar(assigns) do + club_name = assigns[:club_name] || get_club_name() assigns = assign(assigns, :club_name, club_name) ~H"""