Use a compact image-style dropzone for the countdown audio upload
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
12ab64312b
commit
0dfbf1d04a
4 files changed
+92
-20
No files matched your search
+31
-19
@@ -282,26 +282,38 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide-
|
||||
<?= $this->Form->end() ?>
|
||||
<section class="card-section">
|
||||
<h3 id="audio"><?= __('Musik zum Quiz-Countdown') ?></h3>
|
||||
<?php $audioMb = (int)round((int)\Cake\Core\Configure::read('Plenario.audio.maxUploadBytes', 10 * 1024 * 1024) / 1024 / 1024); ?>
|
||||
<p class="hint"><?= __('Eine Audiodatei für die ganze Präsentation (MP3, M4A, OGG oder WAV, bis {0} MB). Sie läuft in der Präsentationsansicht, solange ein Quiz läuft, und wiederholt sich, wenn sie kürzer ist als der Countdown. Teilnehmende hören nichts davon.', $audioMb) ?></p>
|
||||
<?php if ($poll->hasAudio()) : ?>
|
||||
<audio controls preload="none" class="audio-player"
|
||||
src="<?= h($this->Url->build(['_name' => 'participate:audio', 'code' => $poll->join_code, 'file' => $poll->audio])) ?>"></audio>
|
||||
<?php endif; ?>
|
||||
<?= $this->Form->create(null, ['url' => $url('admin:audio'), 'type' => 'file']) ?>
|
||||
<div class="input file">
|
||||
<label for="audio-file"><?= $poll->hasAudio() ? __('Durch andere Datei ersetzen') : __('Audiodatei auswählen') ?></label>
|
||||
<input type="file" id="audio-file" name="audio" accept="audio/mpeg,audio/mp4,audio/ogg,audio/wav,.mp3,.m4a,.ogg,.wav" required>
|
||||
</div>
|
||||
<?= $this->Form->button(__('Hochladen'), ['class' => 'button button--small']) ?>
|
||||
<?php
|
||||
$audioMb = (int)round((int)\Cake\Core\Configure::read('Plenario.audio.maxUploadBytes', 10 * 1024 * 1024) / 1024 / 1024);
|
||||
$audioUrl = $poll->hasAudio()
|
||||
? $this->Url->build(['_name' => 'participate:audio', 'code' => $poll->join_code, 'file' => $poll->audio])
|
||||
: null;
|
||||
?>
|
||||
<p class="hint" id="audio-hint"><?= __('Läuft in der Präsentation, solange ein Quiz läuft, und wiederholt sich bei Bedarf. Teilnehmende hören nichts.') ?></p>
|
||||
<?= $this->Form->create(null, ['url' => $url('admin:audio'), 'type' => 'file', 'class' => 'image-fields', 'data-audio-form' => '']) ?>
|
||||
<input type="file" id="audio-file" name="audio" class="sr-only" aria-describedby="audio-hint"
|
||||
accept="audio/mpeg,audio/mp4,audio/ogg,audio/wav,.mp3,.m4a,.ogg,.wav">
|
||||
<?php if ($audioUrl === null) : ?>
|
||||
<label class="image-drop image-drop--compact" for="audio-file" data-audio-drop>
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"
|
||||
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M9 18V5l11-2v13"/><circle cx="6.5" cy="18" r="2.5"/><circle cx="17.5" cy="16" r="2.5"/>
|
||||
</svg>
|
||||
<span class="image-drop__title"><?= __('Audiodatei auswählen') ?><span data-audio-drop-extra hidden> <?= __('oder hierher ziehen') ?></span></span>
|
||||
<span class="image-drop__hint"><?= __('MP3, M4A, OGG, WAV · bis {0} MB', $audioMb) ?></span>
|
||||
</label>
|
||||
<?php else : ?>
|
||||
<div class="image-fields__row audio-row" data-audio-drop>
|
||||
<audio controls preload="none" class="audio-row__player" src="<?= h($audioUrl) ?>"></audio>
|
||||
<div class="image-fields__buttons">
|
||||
<label class="button button--small" for="audio-file"><?= __('Ersetzen') ?></label>
|
||||
<button type="submit" name="remove" value="1" class="button button--danger button--small"
|
||||
data-confirm="<?= h(__('Die Audiodatei entfernen?')) ?>"><?= __('Entfernen') ?></button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php // Without JavaScript the chosen file is sent with this button; with it, choosing a file sends it right away. ?>
|
||||
<button type="submit" class="button button--small" data-audio-submit><?= __('Hochladen') ?></button>
|
||||
<?= $this->Form->end() ?>
|
||||
<?php if ($poll->hasAudio()) : ?>
|
||||
<?= $this->Form->postButton(__('Audiodatei entfernen'), $url('admin:audio'), [
|
||||
'class' => 'button button--small button--danger',
|
||||
'data' => ['remove' => '1'],
|
||||
'data-confirm' => __('Die Audiodatei entfernen?'),
|
||||
]) ?>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
<section class="card-section">
|
||||
<h3 id="embed"><?= __('In Präsentation einbetten') ?></h3>
|
||||
|
||||
Reference in new issue
Block a user