add userboxes and use them instead of flash

This commit is contained in:
2025-05-20 22:21:06 +03:00
parent ecf89dba19
commit 96922fdd76
19 changed files with 187 additions and 70 deletions

View File

@ -0,0 +1,13 @@
<%
local class = "infobox " .. constants.InfoboxHTMLClass[kind]
local icon = constants.InfoboxIcons[kind]
%>
<div class="<%= class %>">
<span>
<div class="infobox-icon-container">
<% render(icon) %>
</div>
<%= msg %>
</span>
</div>

View File

@ -1,4 +1,5 @@
<% render("views.common.topnav") -%>
<% local is_locked = ntob(thread.is_locked) %>
<main>
<nav class="darkbg">
<h1 class="thread-title"><%= thread.title %></h1>
@ -13,10 +14,13 @@
<% render("views.common.pagination", {page_count = pages, current_page = page}) %>
</nav>
<% if not me:is_guest() then %>
<% if is_locked then -%>
<% render("views.common.infobox", {kind = constants.InfoboxKind.LOCK, msg = "This thread is locked."}) %>
<% end -%>
<% if not me:is_guest() and not is_locked then %>
<h1>Respond to "<%= thread.title %>"</h1>
<form method="post">
<textarea id="post_content" name="post_content" placeholder="Response body" required></textarea><br>
<input type="submit" value="Reply">
<input type="submit" value="Post reply">
</form>
<% end %>

View File

@ -4,8 +4,8 @@
<p>This cannot be undone. This will not delete your posts, only anonymize them.</p>
<p>If you are sure, please type your password below.</p>
<% if err then %>
<h2><%= err %></h2>
<% if infobox then %>
<% render("views.common.infobox", infobox) %>
<% end %>
<form method="post" action="<%= url_for("user_delete", {username = me.username}) %>">

View File

@ -1,8 +1,8 @@
<% render("views.common.topnav") -%>
<div class="darkbg login-container">
<h1>Log In</h1>
<% if err then %>
<h2><%= err %></h2>
<% if infobox then %>
<% render("views.common.infobox", infobox) %>
<% end %>
<form method="post" action="<%= url_for('user_login') %>" enctype="multipart/form-data">
<label for="username">Username</label><br>

View File

@ -1,8 +1,8 @@
<% render("views.common.topnav") -%>
<div class="darkbg settings-container">
<h1>User settings</h1>
<% if flash_msg then %>
<h2><%= flash_msg %></h2>
<% if infobox then %>
<% render("views.common.infobox", infobox) %>
<% end %>
<form class="avatar-form" method="post" action="<%= url_for("user_set_avatar", {username = me.username}) %>" enctype="multipart/form-data">
<img src="<%= avatar_url(me) %>">
@ -10,7 +10,7 @@
<div>
<input type="submit" value="Update avatar">
<% if not me:is_default_avatar() then %>
<input type="submit" value="Clear avatar" formaction="<%= url_for("user_clear_avatar", {username = me.username}) %>">
<input type="submit" value="Clear avatar" formaction="<%= url_for("user_clear_avatar", {username = me.username}) %>" formnovalidate>
<% end %>
</div>
</form>

View File

@ -1,8 +1,8 @@
<% render("views.common.topnav") -%>
<div class="darkbg login-container">
<h1>Sign up</h1>
<% if err then %>
<h2><%= err %></h2>
<% if infobox then %>
<% render("views.common.infobox", infobox) %>
<% end %>
<form method="post" action="<%= url_for('user_signup') %>" enctype="multipart/form-data">
<label for="username">Username</label><br>

View File

@ -1,7 +1,7 @@
<% if just_logged_in then %>
<h1>Logged in successfully.</h1>
<% end %>
<% render("views.common.topnav") -%>
<% if infobox then %>
<% render("views.common.infobox", pop_infobox) %>
<% end %>
<div class="darkbg">
<h1 class="thread-title">Latest posts by <i><%= user.username %></i></h1>
<div>