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,9 +0,0 @@
{{ form_start(form) }}
<div class="pb-4">
{{ form_row(form.displayName) }}
</div>
<button type="submit" class="btn">
aktualisieren
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
+12 -21
View File
@@ -45,28 +45,21 @@
<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 das Dokument wirklich löschen?',
'target-url': path('app_admin_system_document_delete', { 'uuid': document.uuid })
}) }}>
hx-get="{{ path('app_admin_system_document_delete', { 'uuid': document.uuid }) }}"
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': 'Dokument ersetzen',
'url': path('app_admin_system_document_replace', { 'uuid': document.uuid })
}) }}>
hx-get="{{ path('app_admin_system_document_replace', { 'uuid': document.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('refresh') }}
</button>
<button type="button"
{{ stimulus_controller('modal-button', [], [], {'ajax-modal': '#ajax-modal'}) }}
{{ stimulus_action('modal-button', 'ajax', null, {
'title': 'Dokument umbenennen',
'url': path('app_admin_system_document_edit', { 'uuid': document.uuid })
}) }}>
hx-get="{{ path('app_admin_system_document_edit', { 'uuid': document.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('edit') }}
</button>
<a href="{{ path('app_common_download', { 'uuid': document.uuid }) }}"
@@ -90,11 +83,9 @@
</div>
<button type="button"
class="btn"
{{ stimulus_controller('modal-button', [], [], {'ajax-modal': '#ajax-modal'}) }}
{{ stimulus_action('modal-button', 'ajax', null, {
'title': 'Dokumente hinzufügen',
'url': path('app_admin_system_document_upload')
}) }}>
hx-get="{{ path('app_admin_system_document_upload') }}"
hx-target="body"
hx-swap="beforeend">
Dokumente hinzufügen
</button>
{% endblock %}
@@ -0,0 +1,7 @@
{% extends 'htmx_confirmation_modal.html.twig' %}
{% block content %}
<div>
Möchtest du das Dokument <em>{{ document }}</em> wirklich löschen?
</div>
{% endblock %}
@@ -0,0 +1,15 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Dokument umbenennen{% endblock %}
{% block content %}
{{ form_start(form, { 'attr': { 'hx-post': app.request.uri, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML' } }) }}
<div class="pb-4">
{{ form_row(form.displayName) }}
</div>
<button type="submit" class="btn">
aktualisieren
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}
@@ -0,0 +1,20 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Dokument ersetzen{% endblock %}
{% block content %}
{{ form_start(form, { 'attr': { 'hx-post': app.request.uri, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML' } }) }}
<div class="pb-4">
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_document'),
'max_filesize': 5,
'max_files': 1,
'accepted_files': 'application/pdf',
} %}
</div>
<button type="submit" class="btn">
ersetzen
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}
@@ -0,0 +1,19 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Dokumente hinzufügen{% endblock %}
{% block content %}
{{ form_start(form, { 'attr': { 'hx-post': app.request.uri, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML' }}) }}
<div class="pb-4">
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_document'),
'max_filesize': 5,
'accepted_files': 'application/pdf',
} %}
</div>
<button type="submit" class="btn">
Uploads speichern
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}
@@ -1,14 +0,0 @@
{{ form_start(form) }}
<div class="pb-4">
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_document'),
'max_filesize': 5,
'max_files': 1,
'accepted_files': 'application/pdf',
} %}
</div>
<button type="submit" class="btn">
ersetzen
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
@@ -1,13 +0,0 @@
{{ form_start(form) }}
<div class="pb-4">
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_document'),
'max_filesize': 5,
'accepted_files': 'application/pdf',
} %}
</div>
<button type="submit" class="btn">
Uploads speichern
</button>
{{ form_rest(form) }}
{{ form_end(form) }}