moviewyrm/bookwyrm/templates/search/layout.html

71 lines
2.3 KiB
HTML
Raw Normal View History

2021-05-01 01:35:09 +00:00
{% extends 'layout.html' %}
{% load i18n %}
{% block title %}{% trans "Search" %}{% endblock %}
{% block content %}
<div class="block">
<h1 class="title">
{% blocktrans %}Search{% endblocktrans %}
</h1>
</div>
2021-05-01 01:59:02 +00:00
<form class="block" action="{% url 'search' %}" method="GET">
2021-05-01 01:35:09 +00:00
<div class="field has-addons">
<div class="control">
<input type="text" class="input" name="q" value="{{ query }}" aria-label="{% trans 'Search query' %}">
2021-05-01 01:35:09 +00:00
</div>
<div class="control">
2021-05-01 17:55:10 +00:00
<div class="select" aria-label="{% trans 'Search type' %}">
2021-05-01 01:59:02 +00:00
<select name="type">
2021-05-01 01:35:09 +00:00
<option value="book" {% if type == "book" %}selected{% endif %}>{% trans "Books" %}</option>
2021-05-01 03:09:43 +00:00
{% if request.user.is_authenticated %}
2021-05-01 01:35:09 +00:00
<option value="user" {% if type == "user" %}selected{% endif %}>{% trans "Users" %}</option>
2021-05-01 03:09:43 +00:00
{% endif %}
2021-05-01 01:35:09 +00:00
<option value="list" {% if type == "list" %}selected{% endif %}>{% trans "Lists" %}</option>
</select>
</div>
</div>
<div class="control">
<button type="submit" class="button is-primary">
<span>Search</span>
<span class="icon icon-search" aria-hidden="true"></span>
</button>
</div>
</div>
</form>
2021-05-01 02:19:10 +00:00
{% if query %}
2021-05-01 01:35:09 +00:00
<nav class="tabs">
<ul>
2021-05-01 01:59:02 +00:00
<li{% if type == "book" %} class="is-active"{% endif %}>
<a href="{% url 'search' %}?q={{ query }}&type=book">{% trans "Books" %}</a>
2021-05-01 01:35:09 +00:00
</li>
2021-05-01 02:56:29 +00:00
{% if request.user.is_authenticated %}
2021-05-01 01:59:02 +00:00
<li{% if type == "user" %} class="is-active"{% endif %}>
<a href="{% url 'search' %}?q={{ query }}&type=user">{% trans "Users" %}</a>
2021-05-01 01:35:09 +00:00
</li>
2021-05-01 02:56:29 +00:00
{% endif %}
2021-05-01 01:59:02 +00:00
<li{% if type == "list" %} class="is-active"{% endif %}>
<a href="{% url 'search' %}?q={{ query }}&type=list">{% trans "Lists" %}</a>
2021-05-01 01:35:09 +00:00
</li>
</ul>
</nav>
2021-05-01 01:59:02 +00:00
<section class="block">
{% if not results %}
<p>
<em>{% blocktrans %}No results found for "{{ query }}"{% endblocktrans %}</em>
</p>
{% endif %}
2021-05-01 02:56:29 +00:00
{% block panel %}
{% endblock %}
2021-05-01 17:47:01 +00:00
<div>
{% include 'snippets/pagination.html' with page=results path=request.path %}
</div>
2021-05-01 01:59:02 +00:00
</section>
2021-05-01 02:19:10 +00:00
{% endif %}
2021-05-01 01:35:09 +00:00
{% endblock %}