Browse Source

apply search filter for RSS #35

main
ghost 1 year ago
parent
commit
8aff756e30
  1. 16
      src/Controller/TorrentController.php
  2. 16
      templates/default/torrent/list.html.twig

16
src/Controller/TorrentController.php

@ -632,11 +632,11 @@ class TorrentController extends AbstractController
// Get total torrents // Get total torrents
$total = $torrentService->findTorrentsTotal( $total = $torrentService->findTorrentsTotal(
$user->getId(), $request->get('filter') ? 0 : $user->getId(),
$query, $query,
$user->getLocales(), $request->get('filter') ? (array) $request->get('locales') : $user->getLocales(),
$user->getCategories(), $request->get('filter') ? (array) $request->get('categories') : $user->getCategories(),
$user->isSensitive() ? false : null, $request->get('filter') ? ($request->get('sensitive') ? null : false) : ($user->isSensitive() ? false : null),
!$user->isModerator() ? true : null, !$user->isModerator() ? true : null,
!$user->isModerator() ? true : null, !$user->isModerator() ? true : null,
); );
@ -644,11 +644,11 @@ class TorrentController extends AbstractController
// Create torrents list // Create torrents list
$torrents = []; $torrents = [];
foreach ($torrentService->findTorrents( foreach ($torrentService->findTorrents(
$user->getId(), $request->get('filter') ? 0 : $user->getId(),
$query, $query,
$user->getLocales(), $request->get('filter') ? (array) $request->get('locales') : $user->getLocales(),
$user->getCategories(), $request->get('filter') ? (array) $request->get('categories') : $user->getCategories(),
$user->isSensitive() ? false : null, $request->get('filter') ? ($request->get('sensitive') ? null : false) : ($user->isSensitive() ? false : null),
!$user->isModerator() ? true : null, !$user->isModerator() ? true : null,
!$user->isModerator() ? true : null, !$user->isModerator() ? true : null,
$this->getParameter('app.pagination'), $this->getParameter('app.pagination'),

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

@ -11,18 +11,27 @@
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm.5 5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1 0-1zM4 8.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm2 3a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5z"/> <path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm.5 5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1 0-1zM4 8.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm2 3a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5z"/>
</svg> </svg>
</a> </a>
<a class="text-color-night margin-x-4-px" href="{{ path('rss_torrents_recent', { query : query | url_encode(true),
locales : app.request.get('locales'),
categories : app.request.get('categories'),
sensitive : app.request.get('sensitive'),
filter : app.request.get('filter') }) }}" title="RSS">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm1.5 2.5c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1 0-2zm0 4a6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1 0-2zm.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"/>
</svg>
</a>
{% else %} {% else %}
<a class="text-color-night margin-l-4-px" rel="nofollow" href="{{ path('torrent_search', { query : query | url_encode(true), filter : 'true' }) }}" title="{{ 'Show filter' | trans }}"> <a class="text-color-night margin-l-4-px" rel="nofollow" href="{{ path('torrent_search', { query : query | url_encode(true), filter : 'true' }) }}" title="{{ 'Show filter' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-filter-square-fill" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-filter-square-fill" viewBox="0 0 16 16">
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm.5 5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1 0-1zM4 8.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm2 3a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5z"/> <path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm.5 5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1 0-1zM4 8.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm2 3a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5z"/>
</svg> </svg>
</a> </a>
{% endif %}
<a class="text-color-night margin-x-4-px" href="{{ path('rss_torrents_recent', { query : query | url_encode(true) }) }}" title="RSS"> <a class="text-color-night margin-x-4-px" href="{{ path('rss_torrents_recent', { query : query | url_encode(true) }) }}" title="RSS">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm1.5 2.5c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1 0-2zm0 4a6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1 0-2zm.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"/> <path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm1.5 2.5c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1 0-2zm0 4a6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1 0-2zm.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"/>
</svg> </svg>
</a> </a>
{% endif %}
</sub> </sub>
{% else %} {% else %}
<h2>{{ 'Recent uploads' | trans }}</h2> <h2>{{ 'Recent uploads' | trans }}</h2>
@ -186,7 +195,7 @@
{% if query %} {% if query %}
{% if pagination.page > 1 %} {% if pagination.page > 1 %}
{% if pagination.page == 2 %} {% if pagination.page == 2 %}
<a rel="nofollow" class="button margin-l-8-px" href="{{ path('torrent_search', { query : query | url_encode(true) | raw, <a rel="nofollow" class="button margin-l-8-px" href="{{ path('torrent_search', { query : query | url_encode(true),
locales : app.request.get('locales'), locales : app.request.get('locales'),
categories : app.request.get('categories'), categories : app.request.get('categories'),
sensitive : app.request.get('sensitive'), sensitive : app.request.get('sensitive'),
@ -194,7 +203,8 @@
{{ 'Back' | trans | lower }} {{ 'Back' | trans | lower }}
</a> </a>
{% else %} {% else %}
<a rel="nofollow" class="button margin-l-8-px" href="{{ path('torrent_search', { query : query | url_encode(true), page : pagination.page - 1, <a rel="nofollow" class="button margin-l-8-px" href="{{ path('torrent_search', { query : query | url_encode(true),
page : pagination.page - 1,
locales : app.request.get('locales'), locales : app.request.get('locales'),
categories : app.request.get('categories'), categories : app.request.get('categories'),
sensitive : app.request.get('sensitive'), sensitive : app.request.get('sensitive'),

Loading…
Cancel
Save