neofapometer/templates/main/index.html.twig

88 lines
2.2 KiB
Twig

{% extends 'base.html.twig' %}
{% block title %}Hello MainController!{% endblock %}
{% block body %}
<h1>{{ app.user.username }}'s fap history</h1>
<form
hx-post="{{ path('app_fap') }}"
hx-target="#fap-statistics-container"
hx-swap="outerHTML"
>
<button
class="btn btn-success"
type="submit"
>Fap</button>
</form>
<hr>
{% block fap_statistics_container %}
<div class="d-flex flex-column gap-3" id="fap-statistics-container">
<div>
<b>total:</b> {{ app.user.entries|length }}
</div>
<div class="d-flex flex-column">
{% for entry in app.user.entries %}
<div>
{{ entry.dateAt|date('Y-m-d H:i:s') }}
<a
hx-delete="{{ path('app_fap_delete', { id: entry.id }) }}"
hx-target="#fap-statistics-container"
hx-swap="outerHTML"
hx-confirm="Are you sure you wanna delete your hard-worked-for masturbation log entry?"
>
(delete)
</a>
</div>
{% endfor %}
</div>
{% if is_granted('ROLE_CREATE_REGISTRATION_TOKEN') %}
<hr>
<div class="d-flex flex-column">
<b class="mb-2">registation tokens</b>
{% for token in app.user.createdRegistrationTokens %}
<div>
{{ token.createdAt|date('Y-m-d H:i:s') }}
|
<a href="{{ path('app_register', { id: token.id }) }}">
{{ token.id }}
</a>
{#<a
hx-delete="{{ path('app_fap_delete', { id: entry.id }) }}"
hx-target="#fap-statistics-container"
hx-swap="outerHTML"
hx-confirm="Are you sure you wanna delete your hard-worked-for masturbation log entry?"
>
(delete)
</a>#}
</div>
{% else %}
There's no tokens
{% endfor %}
</div>
{% endif %}
</div>
{% endblock %}
<hr>
<div class="d-flex flex-row gap-3">
<a href="{{ path("app_logout") }}">logout</a>
{% if is_granted('ROLE_CREATE_REGISTRATION_TOKEN') %}
<a
hx-post="{{ path("app_register_new_token") }}"
hx-target="#fap-statistics-container"
hx-swap="outerHTML"
>
create invite
</a>
{% endif %}
</div>
{% endblock body %}