feat: integrate with htmx

This commit is contained in:
Björn Fromme
2024-02-07 10:15:59 +01:00
parent 4d1799ca49
commit 1e572606f8
154 changed files with 1447 additions and 1461 deletions
@@ -1,4 +1,4 @@
{{ form_start(form) }}
{{ form_start(form, { 'attr': { 'hx-post': app.request.uri, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML' } }) }}
<div class="flex flex-col space-y-4 pb-8">
{{ form_row(form.name) }}
</div>
+12 -16
View File
@@ -33,20 +33,17 @@
<div class="flex items-center space-x-2 justify-end">
<button type="button"
class="text-red-500"
{{ stimulus_controller('modal-button', [], [], {'confirmation-modal': '#confirmation-modal'}) }}
{{ stimulus_action('modal-button', 'confirmation', null, {
'title': 'Bist du sicher?',
'content': 'Möchtest du die Fortbildung wirklich löschen?',
'target-url': path('app_admin_system_training_delete', { 'id': training.id })
}) }}>
title="Fortbildung löschen"
hx-get="{{ path('app_admin_system_training_delete', { 'id': training.id }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('delete') }}
</button>
<button type="button"
{{ stimulus_controller('modal-button', [], [], {'ajax-modal': '#ajax-modal'}) }}
{{ stimulus_action('modal-button', 'ajax', null, {
'title': 'Fortbildung bearbeiten',
'url': path('app_admin_system_training_edit', { 'id': training.id })
}) }}>
title="Fortbildung bearbeiten"
hx-get="{{ path('app_admin_system_training_edit', { 'id': training.id }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('edit') }}
</button>
</div>
@@ -65,11 +62,10 @@
</div>
<button type="button"
class="btn"
{{ stimulus_controller('modal-button', [], [], {'ajax-modal': '#ajax-modal'}) }}
{{ stimulus_action('modal-button', 'ajax', null, {
'title': 'Fortbildung hinzufügen',
'url': path('app_admin_system_training_create')
}) }}>
title="Fortbildung hinzufügen"
hx-get="{{ path('app_admin_system_training_create') }}"
hx-target="body"
hx-swap="beforeend">
Fortbildung hinzufügen
</button>
{% endblock %}
@@ -0,0 +1,7 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Fortbildung hinzufügen{% endblock %}
{% block content %}
{% include 'admin/system/training/_form.html.twig' %}
{% endblock %}
@@ -0,0 +1,13 @@
{% extends 'htmx_confirmation_modal.html.twig' %}
{% block content %}
<div class="pb-4">
Möchtest du die Fortbildung <em>{{ training.name }}</em> wirklich löschen?
</div>
{% set attendanceCount = training.trainingAttendances|length %}
{% if attendanceCount > 0 %}
<div class="font-bold">
An dieser Fortbildung haben {{ attendanceCount }} Teamer:innern teilgenommen.
</div>
{% endif %}
{% endblock %}
@@ -0,0 +1,7 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Fortbildung bearbeiten{% endblock %}
{% block content %}
{% include 'admin/system/training/_form.html.twig' %}
{% endblock %}