PCv5/app/templates/search.html

78 lines
2.5 KiB
HTML
Raw Normal View History

{% extends "base/base.html" %}
2023-08-09 18:26:38 +02:00
{% import "widgets/pagination.html" as widget_pagination with context %}
{% set tabtitle = "Recherche avancée" %}
{% block content %}
2023-09-05 21:46:57 +02:00
<section class="search-page">
2019-02-03 16:20:05 +01:00
<h1>Recherche avancée</h1>
2023-09-21 14:49:44 +02:00
<form class="form" action="{{ url_for('search') }}" method="get">
{{ form.csrf_token }}
2023-06-13 22:18:17 +02:00
<div class="query">
{{ form.q.label }}
{{ form.q(value=request.args.get('q')) }}
2023-09-05 21:51:25 +02:00
{% for error in form.q.errors %}
<span class="msgerror">{{ error }}</span>
{% endfor %}
</div>
<div class="submit">
{{ form.submit(class_="bg-ok") }}
{% for error in form.submit.errors %}
<span class="msgerror">{{ error }}</span>
{% endfor %}
</div>
2023-06-13 22:18:17 +02:00
<div class="date">
{{ form.date.label }}
2023-06-13 22:18:17 +02:00
{{ form.date(value=request.args.get('date')) }}
2023-09-05 21:51:25 +02:00
{% for error in form.date.errors %}
<span class="msgerror">{{ error }}</span>
{% endfor %}
2023-06-13 22:18:17 +02:00
</div>
<div class="sort">
{{ form.sortBy.label }}
{{ form.sortBy(value=request.args.get('sortBy')) }}
2023-09-05 21:51:25 +02:00
{% for error in form.sortBy.errors %}
<span class="msgerror">{{ error }}</span>
{% endfor %}
2023-06-13 22:18:17 +02:00
</div>
<div class="scope">
{{ form.scope.label }}
{{ form.scope(value=request.args.get('scope')) }}
2023-09-05 21:51:25 +02:00
{% for error in form.scope.errors %}
<span class="msgerror">{{ error }}</span>
{% endfor %}
</div>
2023-09-05 21:46:57 +02:00
<div class="search-results">
{{ widget_pagination.paginate(results, 'search', None, {
'q': request.args.get('q'),
'date': request.args.get('date'),
'sortBy': request.args.get('sortBy')}) }}
{% for i in results.items %}
<div>
{{ i.id }} {{ i.title }}<br>
{% if i.forum %}
<a href="{{ url_for('forum_topic', f=i.forum, page=(i , 'fin')) }}">{{ i.title }}</a>
{% elif i.thread %}
{% if i.thread.owner_program %}
{% if i.thread.owner_program[0].id == i.id %}
<a href="{{ url_for('program_view', page=(i.thread.owner_program[0], '')) }}">{{ i.thread.owner_program[0].name }}</a>
{% else %}
<a href="{{ url_for('redirect_post', postid=i.id) }}">{{ i.thread.owner_program[0].name }}</a>
{% endif %}
{% elif i.thread.owner_topic %}
2023-09-05 21:46:57 +02:00
<a href="{{ url_for('redirect_post', postid=i.id) }}">{{ i.thread.owner_topic[0].title }}</a>
2023-09-12 22:05:38 +02:00
{% endif %}
2023-09-05 21:46:57 +02:00
{% endif %}
{{ i.headline }}<br>
</div>
{% endfor %}
{{ widget_pagination.paginate(results, 'search', None, {
'q': request.args.get('q'),
'date': request.args.get('date'),
'sortBy': request.args.get('sortBy')}) }}
2023-06-13 22:18:17 +02:00
</div>
2023-09-05 21:46:57 +02:00
</form>
2023-06-13 22:18:17 +02:00
</section>
{% endblock %}