All modules, configs, paths, and references updated. 836 tests pass, zero warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
20 lines
667 B
Elixir
20 lines
667 B
Elixir
defmodule BerrypodWeb.AdminLayoutHook do
|
|
@moduledoc """
|
|
LiveView on_mount hook that assigns the current path for admin sidebar navigation.
|
|
"""
|
|
import Phoenix.Component
|
|
|
|
def on_mount(:assign_current_path, _params, _session, socket) do
|
|
socket =
|
|
socket
|
|
|> assign(:current_path, "")
|
|
|> Phoenix.LiveView.attach_hook(:set_current_path, :handle_params, fn _params,
|
|
uri,
|
|
socket ->
|
|
{:cont, assign(socket, :current_path, URI.parse(uri).path)}
|
|
end)
|
|
|
|
{:cont, socket}
|
|
end
|
|
end
|