what2watch/templates/elements/add_watch_button.html

68 lines
2.2 KiB
HTML
Raw Normal View History

{% match quest %}
{% when Some with (q) %}
2024-04-19 21:32:11 +00:00
{% let viz %}
{% let np %}
{% if q.public -%}
2024-04-19 21:32:11 +00:00
{% let viz = "public" %}
{% let np = "private" %}
{% else %}
2024-04-19 21:32:11 +00:00
{% let viz = "private" %}
{% let np = "public" %}
{%- endif %}
{% let status %}
{% if q.watched -%}
{% let status = "watched" %}
2024-04-19 21:32:11 +00:00
{% else %}
{% let status = "want to watch" %}
{% endif %}
<table>
<tbody>
<tr>
2024-04-19 21:32:11 +00:00
<td>{{- status -}}</td>
<td>{{- viz -}}</td>
</tr>
<tr>
<td>
<form id="edit-quest-{{self.watch}}">
2024-04-19 21:32:11 +00:00
{% if q.watched %}
<button hx-post="/quest/edit" 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">
2024-04-19 21:32:11 +00:00
{% else %}
<button hx-post="/quest/edit" hx-target="#add-watch-{{self.watch}}" hx-trigger="click"
hx-swap="outerHTML">mark watched</button>
<input type="hidden" name="watch" value="{{self.watch}}">
<input type="hidden" name="act" value="watched">
{% endif %}
</form>
</td>
<td>
<form id="edit-visibility-{{self.watch}}">
2024-04-19 21:32:11 +00:00
<button hx-post="/quest/edit" hx-target="#add-watch-{{self.watch}}" hx-trigger="click"
hx-swap="outerHTML">mark as {{ np }}</button>
<input type="hidden" name="watch" value="{{self.watch}}">
2024-04-19 21:32:11 +00:00
<input type="hidden" name="act" value="viz">
</form>
</td>
</tr>
</tbody>
</table>
{% when None %}
2024-01-02 01:27:17 +00:00
<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>
2024-01-02 01:27:17 +00:00
<input type="hidden" name="watch" value="{{self.watch}}">
</form>
{% endmatch %}