Initial commit

This commit is contained in:
Bad Manners 2025-04-06 19:14:10 -03:00
commit 2722c7d40a
36 changed files with 6266 additions and 0 deletions

View file

@ -0,0 +1,54 @@
<form hx-put="/post_details/{{ post.id }}" hx-target="this" hx-swap="outerHTML">
<div>
<label>Tags</label>
<input
class="tags"
type="text"
id="search-tags"
name="tags"
hx-post="/search_tags"
hx-trigger="input changed delay:400ms"
hx-target="next .tags-autocomplete"
hx-swap="innerHTML"
hx-on::after-settle="this.focus(); this.setSelectionRange(-1, -1);"
value="{{ tags }}"
autofocus
/>
<ul class="tags-autocomplete" id="search-autocomplete"></ul>
</div>
<div>
<label>Title</label>
<input name="title" type="text" maxlength="100" value="{% if let Some(title) = post.title %}{{ title }}{% endif %}" />
</div>
<div>
<label>Description</label>
<textarea name="description">{% if let Some(description) = post.description %}{{ description }}{% endif %}</textarea>
</div>
<div>
<label>Is public?</label>
<input name="is_public" type="checkbox" {% if post.is_public %}checked{% endif %} value="true" />
</div>
<div>
<label>Rating</label>
<select name="rating">
<option value="u" {% if post.rating == "u" %}selected{% endif %}>Unrated</option>
<option value="s" {% if post.rating == "s" %}selected{% endif %}>Safe</option>
<option value="q" {% if post.rating == "q" %}selected{% endif %}>Questionable</option>
<option value="e" {% if post.rating == "e" %}selected{% endif %}>Explicit</option>
</select>
</div>
<div>
<label>Source(s)</label>
<ul id="sources">
{% for source in sources %}
{% include "post_source.html" %}
{% endfor %}
</ul>
<button hx-post="/post_source" hx-target="#sources" hx-swap="beforeend">+</button>
</div>
<div>
<button>Submit</button>
<button hx-get="/post_details/{{ post.id }}">Cancel</button>
<button hx-confirm="Are you sure that you want to delete this post? This can't be undone!" hx-delete="/post/{{ post.id }}" hx-target="body" hx-replace-url="/posts/1">Delete post</button>
</div>
</div>