home73k/lib/home73k_web/views/layout_view.ex

16 lines
453 B
Elixir
Raw Normal View History

2021-03-28 21:12:55 -04:00
defmodule Home73kWeb.LayoutView do
use Home73kWeb, :view
2021-04-03 23:22:35 -04:00
def navbar_fixed?(conn) do
[Routes.home_path(conn, :index), Routes.home_path(conn, :folio)]
|> Enum.member?(Phoenix.Controller.current_path(conn))
end
def nav_link_opts(conn, opts) do
case Keyword.get(opts, :to) == Phoenix.Controller.current_path(conn) do
false -> opts
true -> Keyword.update(opts, :class, "active", fn c -> "#{c} active" end)
end
end
2021-03-28 21:12:55 -04:00
end