MediaDash/templates/search/index.html

64 lines
2.3 KiB
HTML
Raw Normal View History

2021-08-29 13:03:28 +00:00
{% extends "base.html" %}
{% from "utils.html" import make_tabs, custom_render_form_row %}
{% from 'bootstrap/form.html' import render_form, render_field, render_form_row %}
{% from 'bootstrap/table.html' import render_table %}
{% from 'search/include/tv_show.html' import tv_show_results with context %}
{% from 'search/include/movie.html' import movie_results with context %}
{% from 'search/include/torrent.html' import torrent_results with context %}
{% block styles %}
{{super()}}
<style>
.poster {
height: 500px;
object-fit: cover;
}
</style>
{% endblock %}
{% block app_content %}
{% if form %}
<h1>Search</h1>
{% endif %}
<div class="row">
<div class="col-lg">
{% if session.new_torrents %}
<div class="alert alert-success alert-dismissible fade show" role="alert">
{% for torrent in session.pop('new_torrents',{}).values() %}
<p>
Added <a class="alert-link" href="{{url_for('qbittorrent',infohash=torrent.hash)}}">{{torrent.name}}</a>
</p>
{% endfor %}
</div>
{% endif %}
{% if form %}
<form method="post" class="form">
{{form.csrf_token()}}
{{custom_render_form_row([form.query],render_args={'form_type':'horizontal','horizontal_columns':('lg',1,11)})}}
{{custom_render_form_row([form.tv_shows,form.movies,form.torrents])}}
{{custom_render_form_row([form.group_by_tracker])}}
{{custom_render_form_row([form.indexer])}}
{{custom_render_form_row([form.search])}}
</form>
{% else %}
<h1>Search results for '{{search_term}}'</h1>
{% endif %}
</div>
</div>
{% set search_results = [
(results.tv_shows,"tv","TV Shows",tv_show_results,{}),
(results.movies,"movie","Movies",movie_results,{}),
(results.torrents,"torrent","Torrents",torrent_results,{"group_by_tracker":group_by_tracker}),
] %}
{% if results %}
{% set tabs = [] %}
{% for results,id_name,label,func,kwargs in search_results if results %}
{% do tabs.append((label,func(results,**kwargs))) %}
{% endfor %}
{{make_tabs(tabs)}}
{% endif %}
{% endblock %}