samey/templates/index.html
2025-04-12 11:43:15 -03:00

95 lines
2.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
<title>{{ application_name }}</title>
<meta name="generator" content="Samey {{ env!("CARGO_PKG_VERSION") }}" />
</head>
<body>
<main>
<h1>{{ application_name }}</h1>
<article>
<h2>Search</h2>
<form method="get" action="/posts/1">
<input
class="tags"
type="text"
id="search-tags"
name="tags"
hx-post="/search_tags"
hx-trigger="input changed"
hx-target="next .tags-autocomplete"
hx-vals="js:{selection_end: event.target.selectionEnd}"
hx-on::after-settle="this.focus(); this.setSelectionRange(-1, -1);"
autofocus
/>
<ul class="tags-autocomplete" id="search-autocomplete"></ul>
<button type="submit">Search</button>
</form>
</article>
<article>
<a href="/posts/1">Posts</a>
<a href="/pools/1">Pools</a>
</article>
{% if let Some(user) = user %}
<article>
<h2>Upload media</h2>
<form method="post" action="/upload" enctype="multipart/form-data">
<input
class="tags"
type="text"
id="upload-tags"
name="tags"
hx-post="/search_tags"
hx-trigger="input changed"
hx-target="next .tags-autocomplete"
hx-vals="js:{selection_end: event.target.selectionEnd}"
hx-on::after-settle="this.focus(); this.setSelectionRange(-1, -1);"
/>
<ul class="tags-autocomplete" id="upload-autocomplete"></ul>
<input
type="file"
id="media-file"
name="media-file"
accept=".jpg, .jpeg, .png, .webp, .gif, .mp4, .webm, .mkv, .mov"
/>
<button type="submit">Submit</button>
</form>
</article>
<article>
<h2>Create pool</h2>
<form method="post" action="/pool">
<input
class="pool"
type="text"
id="pool"
name="pool"
maxlength="100"
/>
<button type="submit">Submit</button>
</form>
</article>
<article>
<a href="/logout">Log out</a>
</article>
{% else %}
<article>
<h2>Log in</h2>
<form method="post" action="/login">
<div>
<label>Username</label>
<input id="username" type="text" name="username" />
</div>
<div>
<label>Password</label>
<input id="password" type="password" name="password" />
</div>
<button type="submit">Submit</button>
</form>
</article>
{% endif %}
</main>
</body>
</html>