71 lines
3.4 KiB
Twig
71 lines
3.4 KiB
Twig
{# Learn how to use Turbo Streams: https://github.com/symfony/ux-turbo#broadcast-doctrine-entities-update #}
|
|
{% block create %}
|
|
<turbo-stream action="remove" target="active_downloads_no_downloads">
|
|
</turbo-stream>
|
|
|
|
<turbo-stream action="append" target="active_downloads">
|
|
<template>
|
|
<twig:DownloadListRow download="{{ entity }}" />
|
|
</template>
|
|
</turbo-stream>
|
|
{% endblock %}
|
|
|
|
{% block update %}
|
|
{% if entity.status != "Complete" %}
|
|
<turbo-stream action="update" target="download_progress_{{ id }}">
|
|
<template>
|
|
<div class="text-black text-center rounded-sm text-bold bg-green-300 h-5 relative z-10"
|
|
style="width:{{ entity.progress }}%">
|
|
</div>
|
|
<div class="absolute text-black text-center"
|
|
style="z-index: 400;margin-top: -1.25rem; margin-left: 1.2rem">
|
|
{{ entity.progress }}%
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</turbo-stream>
|
|
<turbo-stream action="update" target="action_buttons_{{ id }}">
|
|
<template>
|
|
{% if entity.status == "In Progress" and entity.progress < 100 %}
|
|
<button id="pause_{{ entity.id }}" class="text-orange-500 mr-1 self-start" {{ stimulus_action('download_list', 'pauseDownload', 'click', {id: entity.id}) }}>
|
|
<twig:ux:icon name="icon-park-twotone:pause-one" width="16.75px" height="16.75px" class="rounded-full" />
|
|
</button>
|
|
{% elseif entity.status == "Paused" %}
|
|
<button id="resume_{{ entity.id }}" class="text-orange-500 mr-1 self-start" {{ stimulus_action('download_list', 'resumeDownload', 'click', {id: entity.id}) }}>
|
|
<twig:ux:icon name="icon-park-twotone:play" width="16.75px" height="16.75px" class="rounded-full" />
|
|
</button>
|
|
{% endif %}
|
|
{% set delete_button = component('ux:icon', {name: 'ic:twotone-cancel', width: '17.5px', class: 'rounded-full align-middle text-red-600' }) %}
|
|
<twig:Modal heading="But wait!" button_text="{{ delete_button }}" submit_action="{{ stimulus_action('download_list', 'deleteDownload', 'click', {id: entity.id}) }}" show_cancel show_submit>
|
|
Are you sure you want to delete <span class="font-bold">{{ entity.filename }}</span>?
|
|
</twig:Modal>
|
|
</template>
|
|
</turbo-stream>
|
|
{% else %}
|
|
<turbo-stream action="remove" target="complete_downloads_no_downloads">
|
|
</turbo-stream>
|
|
|
|
<turbo-stream action="remove" target="ad_download_{{ id }}">
|
|
</turbo-stream>
|
|
|
|
<turbo-stream action="remove" target="action_buttons_{{ id }}">
|
|
</turbo-stream>
|
|
|
|
<turbo-stream action="prepend" target="alert_list">
|
|
<template>
|
|
<twig:Alert title="Finished downloading" message="{{ entity.title }}" alert_id="{{ entity.id }}" data-controller="alert" />
|
|
</template>
|
|
</turbo-stream>
|
|
|
|
<turbo-stream action="prepend" target="complete_downloads">
|
|
<template>
|
|
<twig:DownloadListRow download="{{ entity }}" />
|
|
</template>
|
|
</turbo-stream>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block remove %}
|
|
<turbo-stream action="remove" target="ad_download_{{ id }}"></turbo-stream>
|
|
{% endblock %}
|