Use a trash button to remove a slide image
With JavaScript the "remove image" checkbox is replaced by a button with a trash icon that toggles the same checkbox, dims the preview and announces the pending removal. Without JavaScript the checkbox still works. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a395b50894
commit
8522918c75
3 files changed
+51
-7
No files matched your search
@@ -47,13 +47,25 @@ $maxMb = (int)round((int)Configure::read('Plenario.images.maxUploadBytes', 10 *
|
||||
<img src="<?= h($this->Url->build(['_name' => 'participate:image', 'code' => $poll->join_code, 'file' => $slide->image])) ?>"
|
||||
alt="<?= h((string)$slide->image_alt) ?>" width="<?= (int)$slide->image_width ?>" height="<?= (int)$slide->image_height ?>">
|
||||
</figure>
|
||||
<?= $this->Form->control('remove_image', [
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Bild entfernen'),
|
||||
'value' => '1',
|
||||
'hiddenField' => false,
|
||||
'checked' => false,
|
||||
]) ?>
|
||||
<?php // Without JavaScript the checkbox does the job; with it, the button toggles the same checkbox. ?>
|
||||
<div class="image-fields__remove" data-image-remove>
|
||||
<?= $this->Form->control('remove_image', [
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Bild entfernen'),
|
||||
'value' => '1',
|
||||
'hiddenField' => false,
|
||||
'checked' => false,
|
||||
]) ?>
|
||||
<button type="button" class="button button--danger button--small" hidden aria-pressed="false" data-image-remove-button
|
||||
data-label-remove="<?= h(__('Bild entfernen')) ?>" data-label-undo="<?= h(__('Entfernen rückgängig machen')) ?>">
|
||||
<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
||||
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14M10 11v5M14 11v5"/>
|
||||
</svg>
|
||||
<span data-label><?= __('Bild entfernen') ?></span>
|
||||
</button>
|
||||
<span class="hint" role="status" aria-live="polite" data-image-remove-status></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="input file<?= $imageError ? ' error' : '' ?>">
|
||||
<label for="image-file"><?= $hasImage ? __('Anderes Bild hochladen') : __('Bild hochladen') ?></label>
|
||||
|
||||
Reference in new issue
Block a user