mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-03-31 17:15:38 +00:00
implement torrent posters feature #18
This commit is contained in:
parent
8ae1b3f0b7
commit
bd5191e894
16 changed files with 944 additions and 43 deletions
84
templates/default/torrent/edit/poster.html.twig
Normal file
84
templates/default/torrent/edit/poster.html.twig
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
{% extends 'default/layout.html.twig' %}
|
||||
{% block title %}{{ 'Edit torrent poster' | trans }} - {{ 'Torrent' | trans }} #{{ torrentId }} - {{ name }}{% endblock %}
|
||||
{% block main_content %}
|
||||
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night">
|
||||
<div class="margin-b-24-px padding-b-16-px border-bottom-default">
|
||||
<h1>
|
||||
{{'Edit poster for torrent' | trans }}
|
||||
<a href="{{ path('torrent_info', { torrentId : torrentId }) }}">#{{ torrentId }}</a>
|
||||
</h1>
|
||||
</div>
|
||||
<form name="poster" method="post" enctype="multipart/form-data" action="{{ path('torrent_poster_edit', { torrentId : torrentId }) }}">
|
||||
<div class="margin-y-16-px">
|
||||
{% for error in form.poster.error %}
|
||||
<div class="text-color-red margin-b-8-px">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<input class="width-100" type="file" name="poster" value="" />
|
||||
</div>
|
||||
<div class="padding-t-4-px margin-b-16-px border-bottom-default"></div>
|
||||
<div class="text-right">
|
||||
<a class="margin-r-8-px" href="{{ path('torrent_info', { torrentId : torrentId }) }}">
|
||||
{{'cancel' | trans }}
|
||||
</a>
|
||||
<input class="button-green" type="submit" value="{{'Submit'|trans }}" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% for edition in editions %}
|
||||
<div class="padding-x-24-px padding-y-16-px margin-y-8-px border-radius-3-px {% if edition.active %}background-color-night-light height-148-px{% else %}background-color-night{% endif %} {% if edition.poster %}background-poster{% endif %}"
|
||||
{% if edition.poster %}style="background-image:url('{{ edition.poster }}')"{% endif %}>
|
||||
{% if edition.active %}
|
||||
{{ edition.added | format_ago }}
|
||||
{% else %}
|
||||
<a href="{{ path('torrent_poster_edit', { torrentId : torrentId, torrentPosterId : edition.id }) }}">
|
||||
{{ edition.added | format_ago }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{{ 'by' | trans }}
|
||||
<a href="{{ path('user_info', { userId : edition.user.id }) }}">
|
||||
<img class="border-radius-50 border-color-default vertical-align-middle" src="{{ edition.user.identicon }}" alt="{{'identicon'|trans }}" />
|
||||
</a>
|
||||
<div class="float-right">
|
||||
{% if session.moderator or session.owner %}
|
||||
<a class="margin-r-8-px text-color-red" href="{{ path('torrent_poster_delete', { torrentId : torrentId, torrentPosterId : edition.id }) }}" title="{{ 'Delete' | trans }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
|
||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
|
||||
</svg>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if edition.approved %}
|
||||
{% if session.moderator %}
|
||||
<a href="{{ path('torrent_poster_approve', { torrentId : torrentId, torrentPosterId : edition.id }) }}" title="{{ 'Disapprove' | trans }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
|
||||
</svg>
|
||||
</a>
|
||||
{% else %}
|
||||
<span title="{{ 'Approved' | trans }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
|
||||
</svg>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if session.moderator %}
|
||||
<a href="{{ path('torrent_poster_approve', { torrentId : torrentId, torrentPosterId : edition.id }) }}" title="{{ 'Approve' | trans }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-hourglass" viewBox="0 0 16 16">
|
||||
<path d="M2 1.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-1v1a4.5 4.5 0 0 1-2.557 4.06c-.29.139-.443.377-.443.59v.7c0 .213.154.451.443.59A4.5 4.5 0 0 1 12.5 13v1h1a.5.5 0 0 1 0 1h-11a.5.5 0 1 1 0-1h1v-1a4.5 4.5 0 0 1 2.557-4.06c.29-.139.443-.377.443-.59v-.7c0-.213-.154-.451-.443-.59A4.5 4.5 0 0 1 3.5 3V2h-1a.5.5 0 0 1-.5-.5zm2.5.5v1a3.5 3.5 0 0 0 1.989 3.158c.533.256 1.011.791 1.011 1.491v.702c0 .7-.478 1.235-1.011 1.491A3.5 3.5 0 0 0 4.5 13v1h7v-1a3.5 3.5 0 0 0-1.989-3.158C8.978 9.586 8.5 9.052 8.5 8.351v-.702c0-.7.478-1.235 1.011-1.491A3.5 3.5 0 0 0 11.5 3V2h-7z"/>
|
||||
</svg>
|
||||
</a>
|
||||
{% else %}
|
||||
<span title="{{ 'Waiting for approve' | trans }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-hourglass" viewBox="0 0 16 16">
|
||||
<path d="M2 1.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-1v1a4.5 4.5 0 0 1-2.557 4.06c-.29.139-.443.377-.443.59v.7c0 .213.154.451.443.59A4.5 4.5 0 0 1 12.5 13v1h1a.5.5 0 0 1 0 1h-11a.5.5 0 1 1 0-1h1v-1a4.5 4.5 0 0 1 2.557-4.06c.29-.139.443-.377.443-.59v-.7c0-.213-.154-.451-.443-.59A4.5 4.5 0 0 1 3.5 3V2h-1a.5.5 0 0 1-.5-.5zm2.5.5v1a3.5 3.5 0 0 0 1.989 3.158c.533.256 1.011.791 1.011 1.491v.702c0 .7-.478 1.235-1.011 1.491A3.5 3.5 0 0 0 4.5 13v1h7v-1a3.5 3.5 0 0 0-1.989-3.158C8.978 9.586 8.5 9.052 8.5 8.351v-.702c0-.7.478-1.235 1.011-1.491A3.5 3.5 0 0 0 11.5 3V2h-7z"/>
|
||||
</svg>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
|
@ -29,7 +29,8 @@
|
|||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block main_content %}
|
||||
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night">
|
||||
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night {% if torrent.poster %}background-poster{% endif %}"
|
||||
{% if torrent.poster %}style="background-image:url('{{ torrent.poster }}')"{% endif %}>
|
||||
<h1 class="display-block text-center margin-b-16-px">
|
||||
{{ file.name }}
|
||||
{#{{ 'Torrent' | trans }} #{{ torrent.id }}#}
|
||||
|
|
@ -364,6 +365,22 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<a class="margin-r-4-px{#opacity-0 parent-hover-opacity-09#}" href="{{ path('torrent_poster_edit', { torrentId : torrent.id }) }}" title="{{'Edit'|trans }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708l-3-3zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207l6.5-6.5zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.499.499 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11l.178-.178z"/>
|
||||
</svg>
|
||||
</a>
|
||||
{{ 'Poster' | trans }}
|
||||
<div class="padding-b-8-px border-bottom-default"></div>
|
||||
<div class="padding-t-16-px text-left">
|
||||
{% if torrent.poster %}
|
||||
{{ 'Yes' | trans }}
|
||||
{% else %}
|
||||
{{ 'No' | trans }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a name="activity"></a>
|
||||
<div class="padding-t-16-px padding-b-8-px text-right">
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
</div>
|
||||
{% if torrents %}
|
||||
{% for torrent in torrents %}
|
||||
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night">
|
||||
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night {% if torrent.poster %}background-poster{% endif %}"
|
||||
{% if torrent.poster %}style="background-image:url('{{ torrent.poster }}')"{% endif %}>
|
||||
<a name="{{ torrent.id }}"></a>
|
||||
<div class="margin-b-16-px">
|
||||
<h2>
|
||||
|
|
@ -86,15 +87,6 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
<div class="margin-b-16-px border-bottom-default"></div>
|
||||
{#
|
||||
<sup>
|
||||
{{ torrent.added | format_ago }}
|
||||
{{ 'by' | trans }}
|
||||
<a href="{{ path('user_info', { userId : torrent.user.id }) }}">
|
||||
<img class="border-radius-50 border-color-default vertical-align-middle margin-x-4-px" src="{{ torrent.user.identicon }}" alt="{{ 'identicon' | trans }}" />
|
||||
</a>
|
||||
</sup>
|
||||
#}
|
||||
<span class="margin-r-4-px cursor-default" title="{{ 'Size' | trans }}">
|
||||
<small>
|
||||
{{ torrent.file.size | format_bytes }}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,23 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-y-12-px">
|
||||
{{ 'Posters' | trans }}
|
||||
</td>
|
||||
<td class="padding-y-12-px">
|
||||
<div class="margin-r-8-px">
|
||||
{% if user.posters %}
|
||||
<input name="posters" id="posters" type="checkbox" value="true" checked="checked" />
|
||||
{% else %}
|
||||
<input name="posters" id="posters" type="checkbox" value="true" />
|
||||
{% endif %}
|
||||
<label class="margin-x-4-px" for="posters">
|
||||
{{ 'Enabled' | trans }}
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-b-8-px border-bottom-default text-right" colspan="2">
|
||||
{{ 'Search' | trans }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue