Replaced the custom controller for fragment replacements with symfony streams

This does not require a complete new endpoint
This commit is contained in:
Jan Böhmer 2026-02-22 19:14:35 +01:00
parent 05ee3157fb
commit 910ad939df
5 changed files with 65 additions and 198 deletions

View file

@ -1,14 +1,20 @@
{# Insert flashes #}
<div class="toasts-global d-none">
{% for label, messages in app.flashes() %}
{% for message in messages %}
{{ include('_toast.html.twig', {
'label': label,
'message': message
}) }}
{% endfor %}
{% endfor %}
</div>
{% block flashes %}
{# Insert flashes #}
<turbo-stream action="replace" action="morph" target="toast-container">
<template>
<div class="toast-container" id="toast-container">
{% for label, messages in app.flashes() %}
{% for message in messages %}
{{ include('_toast.html.twig', {
'label': label,
'message': message
}) }}
{% endfor %}
{% endfor %}
</div>
</template>
</turbo-stream>
{% endblock %}
{# Allow pages to request a fully reload of everything #}
{% if global_reload_needed is defined and global_reload_needed %}

View file

@ -10,7 +10,6 @@
<div class="">
<div class="form-group row">
<div class="offset-sm-3 col-sm-9">
<div class="img-thumbnail" style="max-width: 600px;">
<div id="reader-box" {{ stimulus_controller('pages/barcode_scan') }}
data-lookup-url="{{ path('scan_lookup') }}"></div>
@ -18,13 +17,22 @@
</div>
</div>
<div id="scan-augmented-result" class="mt-3">
{% include "label_system/scanner/_info_mode.html.twig" %}
</div>
{{ form_start(form, {'attr': {'id': 'scan_dialog_form'}}) }}
{{ form_end(form) }}
</div>
<div id="scan-augmented-result" class="mt-3">
{% include "label_system/scanner/_info_mode.html.twig" %}
</div>
{{ form_start(form, {'attr': {'id': 'scan_dialog_form'}}) }}
{{ form_end(form) }}
{% endblock %}
{% block scan_results %}
<turbo-stream action="replace" action="morph" target="scan-augmented-result">
<template>
<div id="scan-augmented-result" class="mt-3">
{% include "label_system/scanner/_info_mode.html.twig" %}
</div>
</template>
</turbo-stream>
{% endblock %}