diff --git a/assets/controllers/loading_controller.js b/assets/controllers/loading_controller.js new file mode 100644 index 0000000..ec87b76 --- /dev/null +++ b/assets/controllers/loading_controller.js @@ -0,0 +1,11 @@ +import { Controller} from '@hotwired/stimulus' + +export default class extends Controller { + + static targets = [ 'indicator' ] + static classes = [ 'hidden' ] + + toggle() { + this.indicatorTarget.classList.remove(this.hiddenClass) + } +} \ No newline at end of file diff --git a/src/Controller/Booking/EditController.php b/src/Controller/Booking/EditController.php index 61b3a4f..2b59da4 100644 --- a/src/Controller/Booking/EditController.php +++ b/src/Controller/Booking/EditController.php @@ -82,8 +82,6 @@ class EditController extends AbstractController $form = $this->createForm(BookingType::class, $formData, [ 'attr' => ['novalidate' => 'novalidate'], - 'hx_post' => $this->generateUrl('app_booking_edit', ['id' => $id]), - 'hx_target' => '#myep', ]); $form->handleRequest($request); diff --git a/src/Controller/IndexController.php b/src/Controller/IndexController.php deleted file mode 100644 index 4b88b2c..0000000 --- a/src/Controller/IndexController.php +++ /dev/null @@ -1,18 +0,0 @@ -render('index/index.html.twig'); - } -} \ No newline at end of file diff --git a/src/Controller/PersonalDataController.php b/src/Controller/PersonalDataController.php index d7adc7a..e7f0506 100644 --- a/src/Controller/PersonalDataController.php +++ b/src/Controller/PersonalDataController.php @@ -34,8 +34,6 @@ class PersonalDataController extends AbstractController $personalDataForm = $this->createForm(PersonalDataType::class, $personalData, [ 'attr' => ['novalidate' => 'novalidate'], - 'hx_post' => $this->generateUrl('app_personal_data'), - 'hx_target' => '#myep', ]); $personalDataForm->handleRequest($request); diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 0bba6db..0f25ab0 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -10,7 +10,7 @@ use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; class SecurityController extends AbstractController { - #[Route('/login', name: 'app_login')] + #[Route('/', name: 'app_login')] #[IsGranted('PUBLIC_ACCESS')] public function login(AuthenticationUtils $authenticationUtils): Response { diff --git a/src/EventListener/LogoutListener.php b/src/EventListener/LogoutListener.php deleted file mode 100644 index e224d40..0000000 --- a/src/EventListener/LogoutListener.php +++ /dev/null @@ -1,21 +0,0 @@ -setResponse(new HxRedirectResponse($this->urlGenerator->generate('app_index'))); - } -} diff --git a/src/Form/Extension/HtmxSubmitExtension.php b/src/Form/Extension/HtmxSubmitExtension.php deleted file mode 100644 index a57fdec..0000000 --- a/src/Form/Extension/HtmxSubmitExtension.php +++ /dev/null @@ -1,50 +0,0 @@ -setDefaults([ - 'hx_post' => null, - 'hx_target' => '#htmx-modal', - 'hx_swap' => 'outerHTML', - 'hx_indicator' => '#loading-indicator', - 'hx_trigger' => null, - 'hx_select' => null, - ]); - } - - public function buildView(FormView $view, FormInterface $form, array $options): void - { - if (null !== $options['hx_post']) { - $attr = [ - 'hx-post' => $options['hx_post'], - 'hx-target' => $options['hx_target'], - 'hx-swap' => $options['hx_swap'], - ]; - if (null !== $options['hx_indicator']) { - $attr['hx-indicator'] = $options['hx_indicator']; - } - if (null !== $options['hx_trigger']) { - $attr['hx-trigger'] = $options['hx_trigger']; - } - if (null !== $options['hx_select']) { - $attr['hx-select'] = $options['hx_select']; - } - $view->vars['attr'] = array_merge($view->vars['attr'], $attr); - } - } - - public static function getExtendedTypes(): iterable - { - return [FormType::class]; - } -} diff --git a/src/Htmx/HxRedirectResponse.php b/src/Htmx/HxRedirectResponse.php deleted file mode 100644 index 92d6361..0000000 --- a/src/Htmx/HxRedirectResponse.php +++ /dev/null @@ -1,13 +0,0 @@ - $url]); - } -} \ No newline at end of file diff --git a/src/Htmx/HxTriggerResponse.php b/src/Htmx/HxTriggerResponse.php deleted file mode 100644 index fc96535..0000000 --- a/src/Htmx/HxTriggerResponse.php +++ /dev/null @@ -1,13 +0,0 @@ - $trigger]); - } -} diff --git a/src/Menu/MenuBuilder.php b/src/Menu/MenuBuilder.php index 4541aba..986b799 100644 --- a/src/Menu/MenuBuilder.php +++ b/src/Menu/MenuBuilder.php @@ -24,12 +24,14 @@ class MenuBuilder 'route' => 'app_personal_data', 'linkAttributes' => [ 'title' => 'Persönliche Daten', + 'data-action' => 'loading#toggle', ], ]); $menu->addChild('Meine Buchungen', [ 'route' => 'app_bookings', 'linkAttributes' => [ 'title' => 'Meine Buchungen', + 'data-action' => 'loading#toggle', ], 'extras' => [ 'routes' => [ @@ -41,6 +43,7 @@ class MenuBuilder 'route' => 'app_logout', 'linkAttributes' => [ 'title' => 'Logout', + 'data-action' => 'loading#toggle', ], ]); diff --git a/templates/_partials/_loading_indicator.html.twig b/templates/_partials/_loading_indicator.html.twig new file mode 100644 index 0000000..08857bb --- /dev/null +++ b/templates/_partials/_loading_indicator.html.twig @@ -0,0 +1,4 @@ + diff --git a/templates/booking/edit.html.twig b/templates/booking/edit.html.twig index 6f8f69e..01fcf49 100644 --- a/templates/booking/edit.html.twig +++ b/templates/booking/edit.html.twig @@ -232,11 +232,11 @@
+ class="button bg-button" {{ stimulus_action('loading', 'toggle') }}> zurück
diff --git a/templates/booking/index.html.twig b/templates/booking/index.html.twig index 3ac67ca..7ff0d08 100644 --- a/templates/booking/index.html.twig +++ b/templates/booking/index.html.twig @@ -64,16 +64,19 @@
{% if booking.editable %} bearbeiten {% endif %} + class="button bg-button button--small" + target="_blank" {{ stimulus_action('loading', 'toggle') }}> Bestätigung + class="button bg-button button--small" + target="_blank" {{ stimulus_action('loading', 'toggle') }}> Reisedokumente
diff --git a/templates/index/index.html.twig b/templates/index/index.html.twig deleted file mode 100644 index 07053b8..0000000 --- a/templates/index/index.html.twig +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -
-{% endblock %} \ No newline at end of file diff --git a/templates/layout.html.twig b/templates/layout.html.twig index 4781d75..2fdbd3d 100644 --- a/templates/layout.html.twig +++ b/templates/layout.html.twig @@ -1,23 +1,19 @@ -
-
- {% if is_granted('ROLE_USER') %} - - {% endif %} -
-
+{% extends 'base.html.twig' %} + +{% block body %} +
+
+ {% if is_granted('ROLE_USER') %} + + {% endif %} +
{% block content %}{% endblock %} + {% include '_partials/_flashes.html.twig' %} + {% include '_partials/_loading_indicator.html.twig' %}
-
- {% include '_partials/_spinner.html.twig' with { 'class': 'w-8 h-8'} %} -
- {% include '_partials/_flashes.html.twig' %} -
+{% endblock %} \ No newline at end of file diff --git a/templates/personal_data/index.html.twig b/templates/personal_data/index.html.twig index 48f7880..07dbb6f 100644 --- a/templates/personal_data/index.html.twig +++ b/templates/personal_data/index.html.twig @@ -6,7 +6,7 @@

Persönliche Daten

- {{ form_start(personalDataForm) }} + {{ form_start(personalDataForm, { 'attr': { 'data-action': 'loading#toggle' } }) }}
{{ form_row(personalDataForm.firstName) }} {{ form_row(personalDataForm.name) }} @@ -41,7 +41,7 @@ {{ form_end(personalDataForm) }}
-
+

Newsletter

@@ -50,15 +50,14 @@ angemeldet.

diff --git a/templates/registration/index.html.twig b/templates/registration/index.html.twig index 925c63d..6e2c0a9 100644 --- a/templates/registration/index.html.twig +++ b/templates/registration/index.html.twig @@ -4,24 +4,23 @@

Registrierung MyE&P

- {{ form_start(form) }} + {{ form_start(form, { 'attr': { 'data-action': 'loading#toggle' } }) }}
- {{ form_row(form.firstName) }} - {{ form_row(form.name) }} - {{ form_row(form.email) }} - {{ form_row(form.gender) }} +
+ {{ form_row(form.firstName) }} + {{ form_row(form.name) }} + {{ form_row(form.email) }} + {{ form_row(form.gender) }} +
- +
{{ form_rest(form) }} {{ form_end(form) }} diff --git a/templates/reset_password/index.html.twig b/templates/reset_password/index.html.twig index aec8637..8cd2f6d 100644 --- a/templates/reset_password/index.html.twig +++ b/templates/reset_password/index.html.twig @@ -1,24 +1,26 @@ -{{ form_start(form) }} -{{ form_row(form.email) }} -
- - - -
-{{ form_rest(form) }} -{{ form_end(form) }} +{% extends 'layout.html.twig' %} + +{% block content %} +

+ Passwort vergessen +

+ {{ form_start(form, { 'attr': { 'data-action': 'loading#toggle' } }) }} +
+ {{ form_row(form.email) }} +
+
+ + + zum Login + + + registrieren + +
+ {{ form_rest(form) }} + {{ form_end(form) }} +{% endblock %} \ No newline at end of file diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index 8878e82..e429645 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -14,7 +14,7 @@ {{ error.messageKey|trans(error.messageData, 'security') }}
{% endif %} -
+