mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-06-10 09:19:27 +00:00
89 lines
3.2 KiB
HTML
89 lines
3.2 KiB
HTML
{% extends 'layout.html' %}
|
|
{% load i18n %}
|
|
{% load humanize %}
|
|
|
|
{% block title %}{% trans "Search" %}{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="block">
|
|
<h1 class="title">
|
|
{% blocktrans %}Search{% endblocktrans %}
|
|
</h1>
|
|
</div>
|
|
|
|
<form class="block" action="{% url 'search' %}" method="GET">
|
|
<div class="field has-addons">
|
|
<div class="control">
|
|
<input type="text" class="input" name="q" value="{{ query }}" aria-label="{% trans 'Search query' %}" id="tour-search-page-input" spellcheck="false">
|
|
</div>
|
|
<div class="control">
|
|
<div class="select" aria-label="{% trans 'Search type' %}">
|
|
<select name="type">
|
|
<option value="book" {% if type == "book" %}selected{% endif %}>{% trans "Books" %}</option>
|
|
<option value="author" {% if type == "author" %}selected{% endif %}>{% trans "Authors" %}</option>
|
|
{% if request.user.is_authenticated %}
|
|
<option value="user" {% if type == "user" %}selected{% endif %}>{% trans "Users" %}</option>
|
|
{% endif %}
|
|
<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>{% trans "Search" %}</span>
|
|
<span class="icon icon-search" aria-hidden="true"></span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
{% if query %}
|
|
<nav class="tabs">
|
|
<ul>
|
|
<li{% if type == "book" %} class="is-active"{% endif %}>
|
|
<a href="{% url 'search' %}?q={{ query }}&type=book">{% trans "Books" %}</a>
|
|
</li>
|
|
<li{% if type == "author" %} class="is-active"{% endif %}>
|
|
<a href="{% url 'search' %}?q={{ query }}&type=author">{% trans "Authors" %}</a>
|
|
</li>
|
|
{% if request.user.is_authenticated %}
|
|
<li{% if type == "user" %} class="is-active"{% endif %}>
|
|
<a href="{% url 'search' %}?q={{ query }}&type=user">{% trans "Users" %}</a>
|
|
</li>
|
|
{% endif %}
|
|
<li{% if type == "list" %} class="is-active"{% endif %}>
|
|
<a href="{% url 'search' %}?q={{ query }}&type=list">{% trans "Lists" %}</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
|
|
<section class="block" id="search-results-block">
|
|
<p class="block">
|
|
{% if not results %}
|
|
<em>{% blocktrans %}No results found for "{{ query }}"{% endblocktrans %}</em>
|
|
{% else %}
|
|
<em>{% blocktrans trimmed count counter=results.paginator.count with result_count=results.paginator.count|intcomma %}
|
|
{{ result_count }} result found
|
|
{% plural %}
|
|
{{ result_count }} results found
|
|
{% endblocktrans %}</em>
|
|
{% endif %}
|
|
</p>
|
|
{% block panel %}
|
|
{% endblock %}
|
|
|
|
<div class="block">
|
|
{% include 'snippets/pagination.html' with page=results path=request.path %}
|
|
</div>
|
|
{% block search_footer %}{% endblock %}
|
|
</section>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
{% if request.user.show_guided_tour %}
|
|
{% include 'guided_tour/search.html' %}
|
|
{% endif %}
|
|
{% endblock %}
|