Browse Source

draft torrent sensitive features

main
ghost 1 year ago
parent
commit
5aa20e6a22
  1. 33
      src/Repository/TorrentSensitiveRepository.php
  2. 16
      templates/default/torrent/info.html.twig

33
src/Repository/TorrentSensitiveRepository.php

@ -20,4 +20,37 @@ class TorrentSensitiveRepository extends ServiceEntityRepository @@ -20,4 +20,37 @@ class TorrentSensitiveRepository extends ServiceEntityRepository
{
parent::__construct($registry, TorrentSensitive::class);
}
public function getTorrentSensitive(int $id): ?TorrentSensitive
{
return $this->createQueryBuilder('ts')
->where('ts.id = :id')
->setParameter('id', $id)
->getQuery()
->getOneOrNullResult()
;
}
public function findLastTorrentSensitive(int $torrentId): ?TorrentSensitive
{
return $this->createQueryBuilder('ts')
->where('ts.torrentId = :torrentId')
->setParameter('torrentId', $torrentId)
->orderBy('ts.id', 'DESC') // same to ts.added
->setMaxResults(1)
->getQuery()
->getOneOrNullResult()
;
}
public function findTorrentSensitive(int $torrentId): array
{
return $this->createQueryBuilder('ts')
->where('ts.torrentId = :torrentId')
->setParameter('torrentId', $torrentId)
->orderBy('ts.id', 'DESC') // same to ts.added
->getQuery()
->getResult()
;
}
}

16
templates/default/torrent/info.html.twig

@ -193,6 +193,22 @@ @@ -193,6 +193,22 @@
{% endif %}
</div>
</div>
<div class="padding-y-8-px text-right">
<a class="margin-r-4-px opacity-0 parent-hover-opacity-09" href="{{ path('torrent_edit_locales', { 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>
{{ 'Sensitive'|trans }}
<div class="padding-b-8-px border-bottom-default"></div>
<div class="padding-y-16-px text-left">
{% if torrent.sensitive %}
{{ 'yes'|trans }}
{% else %}
{{ 'no'|trans }}
{% endif %}
</div>
</div>
<div class="padding-y-8-px text-right">
<a class="margin-r-4-px opacity-0 parent-hover-opacity-09" href="{{ path('torrent_edit_locales', { 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">

Loading…
Cancel
Save