split top nav into its own view

This commit is contained in:
Lera Elvoé 2025-05-20 13:12:05 +03:00
parent 8609c33f00
commit f1f218fc75
Signed by: yagich
SSH Key Fingerprint: SHA256:6xjGb6uA7lAVcULa7byPEN//rQ0wPoG+UzYVMfZnbvc
2 changed files with 14 additions and 10 deletions

13
views/common/topnav.etlua Normal file
View File

@ -0,0 +1,13 @@
<nav id="topnav">
<span>
<h1 class="site-title">Porom</h1>
<a href="<%= url_for("all_topics") %>">All topics</a>
</span>
<span>
<% if user:is_logged_in() then -%>
Welcome, <a href="<%= url_for("user", {username = user.username}) %>"><%= user.username %></a>
<% else -%>
Welcome, guest. Please <a href="<%= url_for("user_login") %>">log in</a>
<% end -%>
</span>
</nav>

View File

@ -1,13 +1,4 @@
<nav id="topnav">
<span>
<% if user:is_logged_in() then -%>
Welcome, <a href="<%= url_for("user", {username = user.username}) %>"><%= user.username %></a>
<% else -%>
Welcome, guest. Please <a href="<%= url_for("user_login") %>">log in</a>
<% end -%>
</span>
</nav>
<% render("views.common.topnav", {user = user}) -%>
<main>
<nav id="threadnav">
<h1 class="thread-title"><%= thread.title %></h1>