Add Dashboard nav link for authenticated users

- Add conditional "Dashboard" link in navbar that shows when a user is logged in
- Tests verify the link is hidden for unauthenticated users and visible when authenticated
- Investigation reports for Q1 (drafts/scheduled), Q2 (RSS), Q3 (email subs)
This commit is contained in:
Firehose Bot
2026-07-06 09:11:13 +01:00
parent f6229ebf77
commit fe156ef81e
6 changed files with 715 additions and 4 deletions
@@ -23,6 +23,9 @@
<li>
<a href="/contact" class="btn btn-ghost btn-sm">Contact</a>
</li>
<li :if={@current_scope && @current_scope.user}>
<a href="/editor/dashboard" class="btn btn-ghost btn-sm">Dashboard</a>
</li>
<li>
<.theme_toggle />
</li>
@@ -1,9 +1,32 @@
defmodule FirehoseWeb.PageControllerTest do
use FirehoseWeb.ConnCase
test "GET /", %{conn: conn} do
body = conn |> get(~p"/") |> html_response(200)
assert body =~ "Drinking from the firehose"
assert body =~ "Willem van den Ende"
describe "GET /" do
test "renders the homepage", %{conn: conn} do
body = conn |> get(~p"/") |> html_response(200)
assert body =~ "Drinking from the firehose"
assert body =~ "Willem van den Ende"
end
test "shows navigation links", %{conn: conn} do
body = conn |> get(~p"/") |> html_response(200)
assert body =~ ~s|/blog/engineering|
assert body =~ ~s|/blog/releases|
assert body =~ ~s|/contact|
end
test "does not show dashboard link when unauthenticated", %{conn: conn} do
body = conn |> get(~p"/") |> html_response(200)
refute body =~ ~s|/editor/dashboard|
end
end
describe "GET / when authenticated" do
setup :register_and_log_in_user
test "shows dashboard link in navigation", %{conn: conn} do
body = conn |> get(~p"/") |> html_response(200)
assert body =~ ~s|/editor/dashboard|
end
end
end