Instead of including the template for non-hx-requests, inject the rendered fragment.
22 lines
518 B
HTML
22 lines
518 B
HTML
{% extends "layout.html" %}
|
|
|
|
{% block content %}
|
|
<hgroup>
|
|
<h1>Hello htmx!</h1>
|
|
<p>A new old way to build web applications</p>
|
|
</hgroup>
|
|
<table>
|
|
|
|
{% match fragment %}
|
|
{% when Some with (fragment) %}
|
|
{{ fragment|safe }}
|
|
{% when None %}
|
|
<tr><td>
|
|
<button hx-get="/user" hx-target="table" hx-push-url="true">
|
|
Load data
|
|
</button>
|
|
</td></tr>
|
|
{% endmatch %}
|
|
</table>
|
|
{% endblock %}
|