feat: add basic htmx example

This commit is contained in:
Alexander Navarro 2025-02-26 04:16:11 -03:00
parent 17bf419074
commit ffca6175c0
6 changed files with 80 additions and 25 deletions

View file

@ -1,10 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="@mini-strap/core" />
<script type="module" src="htmx.org"></script>
<link rel="stylesheet" href="../css/style.css" />
<script type="module" src="htmx.org"></script>
<title>
{% block title %}Axum web service!{% endblock %}
</title>

View file

@ -1,26 +1,34 @@
{% extends "base.html" %}
{% block content %}
<table>
<thead>
<tr>
<th class="msp-text-center">Database</th>
<th class="msp-text-center">Version</th>
<th class="msp-text-center">Database Name</th>
<th class="msp-text-center">Current User</th>
<th class="msp-text-center">Current Timestamp</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
<th>{{ row.database }}</th>
<th>{{ row.version }}</th>
<th>{{ row.current_database }}</th>
<th>{{ row.current_user }}</th>
<th>{{ row.current_timestamp }}</th>
</tr>
{% endfor %}
</tbody>
</table>
<div class="msp-hstack msp-justify-content-end msp-mb-3">
<button class="msp-btn-sm" hx-get="/" hx-target="#example-table">Refresh</button>
</div>
{% block htmx %}
<table id="example-table">
<thead>
<tr>
<th class="msp-text-center">Database</th>
<th class="msp-text-center">Version</th>
<th class="msp-text-center">Database Name</th>
<th class="msp-text-center">Current User</th>
<th class="msp-text-center">Current Timestamp</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
<th>{{ row.database }}</th>
<th>{{ row.version }}</th>
<th>{{ row.current_database }}</th>
<th>{{ row.current_user }}</th>
<th>{{ row.current_timestamp }}</th>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock htmx %}
{% endblock content %}