46 lines
1.3 KiB
HTML
46 lines
1.3 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Search{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container mt-4">
|
|
<h1 class="mb-3">Search Plants</h1>
|
|
<form method="post" novalidate>
|
|
{{ form.hidden_tag() }}
|
|
<div class="form-group mb-3">
|
|
{{ form.query.label(class="form-label") }}
|
|
{{ form.query(class="form-control", placeholder="Enter search term…") }}
|
|
{% if form.query.errors %}
|
|
<div class="text-danger small">
|
|
{{ form.query.errors[0] }}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
<div class="form-group mb-3">
|
|
{{ form.tags.label(class="form-label") }}
|
|
{{ form.tags(class="form-select", multiple=true) }}
|
|
{% if form.tags.errors %}
|
|
<div class="text-danger small">
|
|
{{ form.tags.errors[0] }}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">{{ form.submit.label.text }}</button>
|
|
</form>
|
|
|
|
<hr class="my-4">
|
|
|
|
{% if results %}
|
|
<ul class="list-group">
|
|
{% for plant in results %}
|
|
<li class="list-group-item">
|
|
<a href="{{ url_for('plant.view', plant_id=plant.id) }}">
|
|
{{ plant.common_name or plant.scientific_name }}
|
|
</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% elif request.method == 'POST' %}
|
|
<p class="text-muted">No results found.</p>
|
|
{% endif %}
|
|
</div>
|