better layout: search on its own row above action buttons

This commit is contained in:
lichenblankie 2026-06-05 04:23:08 +00:00
parent 3279f72a51
commit c0f1c8e6f8

View file

@ -45,9 +45,18 @@ FORUM_CSS = """
.forum-form label.checkbox-label { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; } .forum-form label.checkbox-label { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.forum-form label.inline-label { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; white-space: nowrap; } .forum-form label.inline-label { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; white-space: nowrap; }
.forum-form small { display: block; margin-bottom: 8px; } .forum-form small { display: block; margin-bottom: 8px; }
.forum-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0.5rem 0; } .forum-search { margin: 0.5rem 0; }
.forum-actions form { display: inline; } .forum-search form { display: block; }
.forum-actions input[name=q] { width: 200px; padding: 8px 12px; } .forum-search input[name=q] {
width: 100%; box-sizing: border-box; padding: 10px 12px;
background: rgba(8, 18, 22, 0.8); border: 1px solid rgba(40, 70, 65, 0.4);
border-radius: 4px; color: #90b4ac; font-size: 0.95rem;
transition: border-color 0.2s, box-shadow 0.3s;
}
.forum-search input[name=q]:focus {
outline: none; border-color: rgba(80, 140, 110, 0.5); box-shadow: 0 0 18px rgba(100, 200, 150, 0.06);
}
.forum-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0.5rem 0; }
a.forum-action, a.forum-action-inline { a.forum-action, a.forum-action-inline {
color: #5a7880; text-decoration: none; border-bottom: none; font-size: 0.88rem; color: #5a7880; text-decoration: none; border-bottom: none; font-size: 0.88rem;
padding: 8px 14px; border: 1px solid rgba(40, 70, 65, 0.3); border-radius: 4px; padding: 8px 14px; border: 1px solid rgba(40, 70, 65, 0.3); border-radius: 4px;
@ -255,7 +264,7 @@ class ForumHandlers:
items = "<p>No threads yet.</p>" items = "<p>No threads yet.</p>"
new_label = f" ({new_count} new)" if new_count else "" new_label = f" ({new_count} new)" if new_count else ""
search_form = ( search_form = (
f'<form method="get" action="/forum" style="display:inline">' f'<form method="get" action="/forum">'
f'<input name="q" placeholder="search forum" size="30" value="{esc(search)}">' f'<input name="q" placeholder="search forum" size="30" value="{esc(search)}">'
f'</form>' f'</form>'
) )
@ -264,12 +273,14 @@ class ForumHandlers:
page_url = f'/forum?q={esc(search)}&tag={esc(tag)}&muted=1' if show_muted else (f'/forum?q={esc(search)}&tag={esc(tag)}' if search or tag else '/forum') page_url = f'/forum?q={esc(search)}&tag={esc(tag)}&muted=1' if show_muted else (f'/forum?q={esc(search)}&tag={esc(tag)}' if search or tag else '/forum')
return self._respond( return self._respond(
f"<h1>forum{tag_label}</h1>" f"<h1>forum{tag_label}</h1>"
f'<div class="forum-actions">' f'<div class="forum-search">'
f'{search_form}' f'{search_form}'
f' <a class="forum-action" href="/forum/new">+ new</a>' f"</div>"
f' <a class="forum-action" href="/forum/moderation">mod</a>' f'<div class="forum-actions">'
f' <a class="forum-action" href="/forum/sync/now">sync now</a>' f'<a class="forum-action" href="/forum/new">+ new</a>'
f' {muted_link}' f'<a class="forum-action" href="/forum/moderation">mod</a>'
f'<a class="forum-action" href="/forum/sync/now">sync now</a>'
f'{muted_link}'
f"</div>" f"</div>"
f"<p class=\"meta\">{total} threads{new_label}</p>" f"<p class=\"meta\">{total} threads{new_label}</p>"
f'<ul class="forum-list">{items}</ul>' f'<ul class="forum-list">{items}</ul>'