what2watch/templates/elements/add_watch_button.html
Joe Ardent d90011b619 Add html items for updating quest status.
Still need add a handler to edit quest status (remove, change publicity).
2024-04-18 18:03:54 -07:00

59 lines
1.7 KiB
HTML

{% match quest %}
{% when Some with (q) %}
{% let public %}
{% let np %}
{% if q.public -%}
{% let public = "public" %}
{% let np = "private" %}
{% else %}
{% let public = "private" %}
{% let np = "public" %}
{%- endif %}
{% let status %}
{% if q.watched -%}
{% let status = "want to watch" %}
{% else %}
{% let status = "watched" %}
{% endif %}
<table>
<tbody>
<tr>
<td>Added</td>
<td>{{- public -}}</td>
</tr>
<tr>
<td>
<form id="edit-quest-{{self.watch}}">
<button hx-post="/edit/quest" hx-target="#add-watch-{{self.watch}}" hx-trigger="click"
hx-swap="outerHTML">remove</button>
<input type="hidden" name="watch" value="{{self.watch}}">
<input type="hidden" name="act" value="remove">
</form>
</td>
<td>
<form id="edit-visibility-{{self.watch}}">
<button hx-post="/edit/quest" hx-target="#add-watch-{{self.watch}}" hx-trigger="click"
hx-swap="outerHTML">mark as {{ np }}</button>
<input type="hidden" name="watch" value="{{self.watch}}">
</form>
</td>
</tr>
</tbody>
</table>
{% when None %}
<form id="add-watch-{{self.watch}}">
<button hx-post="/add/watch" hx-target="#add-watch-{{self.watch}}" hx-trigger="click"
hx-swap="outerHTML">add</button>
<select name="public" id="add-public-watch">
<option value="true">public</option>
<option value="false">private</option>
</select>
<input type="hidden" name="watch" value="{{self.watch}}">
</form>
{% endmatch %}