MyTube/templates/dashboard/links.html.twig
2021-01-17 22:48:12 +01:00

127 lines
No EOL
6 KiB
Twig

{% extends 'base.html.twig' %}
{% block title %}Links{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset("css/links.css") }}">
{% endblock %}
{% block body %}
{% if links | length == 0 %}
<div class="no-content">
No links yet.<br/>
Go to the <a href="{{ path("app_dashboard") }}">Dashboard</a> and click the link-icon on a video you want to
create a link for.
</div>
{% else %}
{% set deleteCsrfToken = csrf_token(constant("App\\Controller\\DashboardController::DELETE_LINK_CSRF_TOKEN_ID")) %}
<div class="links bg-light shadow-5">
<table class="table table-hover">
<tr>
<td></td>
<th>
Video
</th>
<th>
Created
</th>
<th>
Comment
</th>
<th>
Valid until
</th>
<th>
Views left
</th>
<th>
Time left
</th>
<th>
</th>
</tr>
{% for link in links %}
<tr>
<td>
{% if not link.viewable() %}
<i class="fas fa-exclamation-circle"></i>
{% endif %}
</td>
<td>
<a href="{{ path("app_watch_page", {
linkId: constant("App\\Controller\\WatchController::OWNER_LINK_ID"),
videoId: link.video.customId
}) }}">
<img alt="Thumbnail" src="{{ path("app_watch_thumbnail", {
linkId: constant("App\\Controller\\WatchController::OWNER_LINK_ID"),
videoId: link.video.customId
}) }}"/>
{{ link.video.name }}
</a>
</td>
<td>
{{ link.created | date("Y-m-d") }}
</td>
<td>
{{ link.comment }}
</td>
<td>
{% if link.viewableUntil %}
{{ link.viewableUntil | date("Y-m-d") }}
{% else %}
-
{% endif %}
</td>
<td>
{% if link.maxViews %}
{{ link.viewsLeft }} / {{ link.maxViews }}
{% else %}
-
{% endif %}
</td>
<td>
{% if link.viewableFor %}
{{ link.viewableForLeft != null ? link.viewableForLeft : "-" }} / {{ link.viewableFor }} h
{% else %}
-
{% endif %}
</td>
<td class="no-wrap">
<div class="btn-group" role="group">
<button class="btn btn-link" onclick="clipboard('{{ url("app_watch_page", {
linkId: link.customId,
videoId: link.video.customId
}) }}')"><i class="fas fa-clipboard"></i>
</button>
<a class="btn btn-link" href="{{ path("app_edit_link") }}?link={{ link.customId }}">
<i class="fas fa-cog"></i>
</a>
<form action="{{ path("app_link_delete") }}" method="POST">
<input type="hidden" name="linkId" value="{{ link.customId }}">
<input type="hidden" name="csrfToken" value="{{ deleteCsrfToken }}">
<button class="btn btn-link dropdown-toggle deleteToggle" style="color: red;"
id="{{ link.customId }}-deleteDropDown"
data-mdb-toggle="dropdown"
aria-expanded="false"
onclick="">
<i class="fas fa-trash-alt"></i>
</button>
<div class="dropdown-menu dropdown-menu-end deleteConfirm"
id="{{ link.customId }}-deleteDropDownMenu"
aria-labelledby="{{ link.customId }}-deleteDropDown">
Do you really want to delete this link?<br/>
<button class="btn btn-link deleteButton">YES</button>
<button class="btn btn-primary" onclick="removeClass('show', [
'#{{ link.customId }}-deleteDropDown',
'#{{ link.customId }}-deleteDropDownMenu'
]); return false;">NO
</button>
</div>
</form>
</div>
</td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% endblock %}