Implemented proper search engine
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<form method="GET" action="{% url 'work_list' %}">
|
||||
<div class="field has-addons">
|
||||
<div class="control is-expanded">
|
||||
<input class="input" name="filter" type="text" placeholder="Find a work" value="{{ request.GET.filter }}"/>
|
||||
<input class="input" name="q" type="text" placeholder="Find a work" value="{{ request.GET.filter }}"/>
|
||||
</div>
|
||||
<div class="control">
|
||||
<a class="button" href="?"><i class="fas fa-times"></i></a>
|
||||
@@ -32,10 +32,10 @@
|
||||
</p>
|
||||
<p>
|
||||
{% for tag in collection.tags %}
|
||||
<a href="{% url 'collection_work_list' collection.pk %}?filter=tag:{{ tag }}" class="tag is-success">{{ tag }}</a>
|
||||
<a href="{% url 'collection_work_list' collection.pk %}?q=tag:{{ tag }}" class="tag is-success">{{ tag }}</a>
|
||||
{% endfor %}
|
||||
{% for genre in collection.genres %}
|
||||
<a href="{% url 'collection_work_list' collection.pk %}?filter=genre:{{ genre }}" class="tag is-warning">{{ genre }}</a>
|
||||
<a href="{% url 'collection_work_list' collection.pk %}?q=genre:{{ genre }}" class="tag is-warning">{{ genre }}</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
</div>
|
||||
@@ -47,4 +47,4 @@
|
||||
<div>
|
||||
<small>{{ ensemble.ensemble_code }}</small>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<form method="GET">
|
||||
<div class="field has-addons">
|
||||
<div class="control is-expanded">
|
||||
<input class="input" name="filter" type="text" placeholder="Filter" value="{{ request.GET.filter }}"/>
|
||||
<input class="input" name="q" type="text" placeholder="Filter" value="{{ request.GET.q }}"/>
|
||||
</div>
|
||||
<div class="control">
|
||||
<a class="button" href="?"><i class="fas fa-times"></i></a>
|
||||
@@ -23,6 +23,15 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% if letters %}
|
||||
<div class="has-text-centered">
|
||||
<a href="?">_</a>
|
||||
{% for letter in letters %}
|
||||
<a href="?start={{ letter }}">{{ letter }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<table class="table is-striped is-fullwidth">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -35,7 +44,9 @@
|
||||
<tbody>
|
||||
{% for work in object_list %}
|
||||
<tr>
|
||||
<td><a href="{% url 'work_detail' collection=work.collection.pk pk=work.pk %}">{{ work.name }}</a></td>
|
||||
<td>
|
||||
<a href="{% url 'work_detail' collection=work.collection_id pk=work.pk %}">{{ work.name }}</a>
|
||||
</td>
|
||||
<td title="{{ work.composer }}">{{ work.composer|truncatewords:3 }}</td>
|
||||
<td class="is-hidden-mobile" title="{{ work.edition }}">{{ work.edition|truncatewords:2 }}</td>
|
||||
{% if not collection %}<td class="is-hidden-touch">{{ work.collection.name }}</td>{% endif %}
|
||||
@@ -46,20 +57,41 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<footer>
|
||||
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
|
||||
{% if page_obj.has_previous %}
|
||||
<a class="pagination-previous" href="{% url_update page=page_obj.prev_page_number %}">Previous</a>
|
||||
{% endif %}
|
||||
{% if page_obj.has_next %}
|
||||
<a class="pagination-next" href="{% url_update page=page_obj.next_page_number %}">Next page</a>
|
||||
{% endif %}
|
||||
<a class="pagination-previous"
|
||||
{% if page_obj.has_previous %}
|
||||
href="{% url_update page=page_obj.previous_page_number %}"
|
||||
{% else %}
|
||||
disabled
|
||||
{% endif %}>
|
||||
Previous</a>
|
||||
<a class="pagination-next"
|
||||
{% if page_obj.has_next %}
|
||||
href="{% url_update page=page_obj.next_page_number %}"
|
||||
{% else %}
|
||||
disabled
|
||||
{% endif %}>
|
||||
Next
|
||||
</a>
|
||||
<ul class="pagination-list">
|
||||
{% for page in page_obj.paginator.page_range %}
|
||||
{% for page in page_range %}
|
||||
<li>
|
||||
<a class="pagination-link {% if forloop.counter == page_obj.number %}is-current{% endif %}" href="{% url_update page=forloop.counter %}" aria-label="Goto page {{ forloop.counter }}">{{ forloop.counter }}</a>
|
||||
{% if page == '...' %}
|
||||
{{ page }}
|
||||
{% else %}
|
||||
<a class="pagination-link {% if page == page_obj.number %}is-current{% endif %}" href="{% url_update page=page %}" aria-label="Goto page {{ page }}">{{ page }}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{% endblock %}
|
||||
{% if meta %}
|
||||
<div class="has-text-right has-text-grey-light is-size-7">
|
||||
Query="{{ meta.query }}"
|
||||
</div>
|
||||
{% endif %}
|
||||
</footer>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user