Add infinity scrolling for /domains

This commit is contained in:
Joakim Hellsén 2024-03-26 02:39:30 +01:00
commit 816700a63b
No known key found for this signature in database
GPG key ID: D196AE66FEBE1DC9
3 changed files with 33 additions and 24 deletions

View file

@ -1,19 +1,5 @@
{% extends "base.html" %}
{% block content %}
<h2>Domains</h2>
<p>
These are the domains that have been added to the database.
{% if domains|length > 0 %}There are {{ domains|length }} domains in the database.{% endif %}
</p>
<ul>
{% for domain in domains %}
{% if not domain.hidden %}
<li>
<a href="{% url 'domain' domain.id %}">{{ domain.url }}</a> - {{ domain.created_at|date }}
</li>
{% endif %}
{% empty %}
<li>Found no domains in the database.</li>
{% endfor %}
</ul>
{% include "partials/domains.html" %}
{% endblock %}

View file

@ -0,0 +1,12 @@
{% if domains %}
{% for domain in domains %}
<a href="{% url 'domain' domain.id %}">{{ domain.url }}</a> - {{ domain.created_at|date }}
<br>
{% endfor %}
{% else %}
<p>No domains yet. Time to add some!</p>
{% endif %}
<div hx-get="{% url 'domains' %}?page={{ page|add:1 }}"
hx-trigger="revealed"
hx-target="this"
hx-swap="outerHTML">Loading...</div>