wip-feat: mercure alerts
This commit is contained in:
5
templates/broadcast/Alert.html.twig
Normal file
5
templates/broadcast/Alert.html.twig
Normal file
@@ -0,0 +1,5 @@
|
||||
<turbo-stream action="prepend" target="alert_list">
|
||||
<template>
|
||||
<twig:Alert :title="title|default('')" :message="message" :alert_id="alert_id" data-controller="alert" />
|
||||
</template>
|
||||
</turbo-stream>
|
||||
55
templates/broadcast/Download.stream.html.twig
Normal file
55
templates/broadcast/Download.stream.html.twig
Normal file
@@ -0,0 +1,55 @@
|
||||
{# Learn how to use Turbo Streams: https://github.com/symfony/ux-turbo#broadcast-doctrine-entities-update #}
|
||||
{% block create %}
|
||||
<turbo-stream action="append" target="active_downloads">
|
||||
<template>
|
||||
<twig:DownloadListRow
|
||||
id="ad_download_{{ entity.id }}"
|
||||
data="{{ entity.id }}">
|
||||
</twig:DownloadListRow>
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% endblock %}
|
||||
|
||||
{% block update %}
|
||||
{% if entity.status != "Complete" %}
|
||||
<turbo-stream action="update" target="ad_download_{{ id }}">
|
||||
<template>
|
||||
<div class="title">{{ entity.title }}</div>
|
||||
<div class="filename">{{ entity.filename }}</div>
|
||||
<div class="status">
|
||||
<span class="pill {{ status_color_map[entity.status] }} status-badge">{{ entity.status }}</span>
|
||||
<span class="pill progress">{{ entity.progress }}%</span>
|
||||
</div>
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% else %}
|
||||
<turbo-stream action="remove" target="ad_download_{{ id }}">
|
||||
</turbo-stream>
|
||||
|
||||
<turbo-stream action="prepend" target="alert_list">
|
||||
<template>
|
||||
<li class="alert alert-success alert-dismissible" id="alert_{{ entity.id }}" data-controller="alert">
|
||||
<span class="alert-filename">{{ entity.filename }}</span> has finished downloading.
|
||||
</li>
|
||||
</template>
|
||||
</turbo-stream>
|
||||
|
||||
<turbo-stream action="prepend" target="complete_downloads_list">
|
||||
<template>
|
||||
<div class="result_group download-item" id="cd_download_{{ entity.id }}">
|
||||
<div class="title">{{ entity.title }}</div>
|
||||
<div class="filename">{{ entity.filename }}</div>
|
||||
<div class="status">
|
||||
<span class="pill {{ status_color_map[entity.status] }} status-badge">{{ entity.status }}</span>
|
||||
<span class="pill progress">{{ entity.progress }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block remove %}
|
||||
<turbo-stream action="remove" target="ad_download_{{ id }}"></turbo-stream>
|
||||
<turbo-stream action="remove" target="cd_download_{{ id }}"></turbo-stream>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user