82 lines
3.9 KiB
Twig
82 lines
3.9 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>
|
|
<tr data-download-list-target="download" id="ad_download_{{ entity.id }}">
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 min-w-[45ch] max-w-[45ch] truncate">
|
|
{{ entity.title }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-50">
|
|
{% if entity.progress < 100 %}
|
|
<div class="w-[3.25ch] h-[3.25ch] bg-purple-600 rounded-full block text-center table-cell align-middle text-xs text-gray-50">
|
|
{{ entity.progress }}
|
|
</div>
|
|
{% else %}
|
|
<twig:StatusBadge color="green" status="Complete" />
|
|
{% endif %}
|
|
</td>
|
|
<td></td>
|
|
</tr>
|
|
</template>
|
|
</turbo-stream>
|
|
{% endblock %}
|
|
|
|
{% block update %}
|
|
{% if entity.status != "Complete" %}
|
|
<turbo-stream action="update" target="ad_download_{{ id }}">
|
|
<template>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 min-w-[45ch] max-w-[45ch] truncate">
|
|
{{ entity.title }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-end text-gray-800 dark:text-gray-50">
|
|
<div class="border-2 border-green-700 rounded-md w-full h-6 align-middle overflow-hidden">
|
|
<div class="text-green-700 rounded-sm text-bold text-gray-950 text-center bg-green-600 h-5" style="width:{{ entity.progress }}%">{{ entity.progress }}%</div>
|
|
</div>
|
|
</td>
|
|
<td></td>
|
|
</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="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>
|
|
<tr id="ad_download_{{ entity.id }}">
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 min-w-[45ch] max-w-[45ch] truncate">
|
|
{{ entity.title }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-50">
|
|
<twig:StatusBadge color="green" status="Complete" />
|
|
</td>
|
|
<td class="px-6 py-4 flex flex-row align-middle justify-center">
|
|
<button {{ stimulus_action('download_list', 'deleteDownload', 'click', {id: download.id}) }}>
|
|
<twig:ux:icon
|
|
name="ic:twotone-cancel" width="18px"
|
|
class="rounded-full align-middle text-red-600"
|
|
title="Remove {{ download.title }} from download list. This will not delete the file."
|
|
/>
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
</template>
|
|
</turbo-stream>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block remove %}
|
|
<turbo-stream action="remove" target="ad_download_{{ id }}"></turbo-stream>
|
|
{% endblock %}
|