simplesite icon indicating copy to clipboard operation
simplesite copied to clipboard

Active search - display all artists when search box is empty

Open tataraba opened this issue 2 years ago • 0 comments

For 04_htmx branch:

When selecting the "search" element (<input>), the html response that gets rendered in the "#search-results" div is empty (nothing found).

image

Instead, the element should populate with all artists by default. Once the search is started (on keypress), it filters down appropriately.

Right now, the search.html template has this block:

{% block content %}
<section id="body" class="flex flex-col bg-slate-50 justify-center items-center max-w-screen-lg m-auto">
    <div class="flex flex-col justify-center items-center py-10 min-w-full">
        <h2 class="text-2xl leading-relaxed text-slate-800 uppercase">Search Results</h2>
        <div id="search-results" class="flex flex-row flex-wrap justify-center content-center text-center w-full">
            {% if search|list %}
                {% for result in results %}
                    <p>{{result["name"]}}</p>
                {% endfor %}
            {% else %}
                <p>No results found.</p>
            {% endif %}
        </div>
    </div>
</section>
{% endblock %}

Maybe adding a default for all results in the {% else %} statement?

tataraba avatar Mar 27 '23 16:03 tataraba