aboutsummaryrefslogtreecommitdiff
path: root/templates/sidebar
diff options
context:
space:
mode:
authorRasmus Fuhse <fuhse@data-quest.de>2024-05-28 04:50:35 +0000
committerJan-Hendrik Willms <tleilax+github@gmail.com>2024-05-28 16:39:56 +0200
commit403829e0fcd98ec8166d47ae06cafe2742168643 (patch)
tree7e119de93760b40de94ffd6d16221f123c03f16f /templates/sidebar
parentc043ae23c4a10d3ba576de4d8f136823f86e757d (diff)
Resolve "VA-Administration: Filter nach Text-Datenfelder funktionieren nicht"
Closes #4215 Merge request studip/studip!3042
Diffstat (limited to 'templates/sidebar')
-rw-r--r--templates/sidebar/search-widget.php23
1 files changed, 17 insertions, 6 deletions
diff --git a/templates/sidebar/search-widget.php b/templates/sidebar/search-widget.php
index 6d870ba..5bbc77e 100644
--- a/templates/sidebar/search-widget.php
+++ b/templates/sidebar/search-widget.php
@@ -1,6 +1,7 @@
<form action="<?= URLHelper::getLink($url) ?>"
method="<?= $method ?>"
- <? if (isset($id)) printf('id="%s"', htmlReady($id)); ?>
+ <? $id = $id ?? 'form-'.md5(uniqid()) ?>
+ <? printf('id="%s"', htmlReady($id)) ?>
<?= $onsubmit ? 'onsubmit="'.htmlReady($onsubmit).'"' : '' ?>
class="sidebar-search">
<? foreach ($url_params as $key => $value): ?>
@@ -8,9 +9,10 @@
<? endforeach; ?>
<ul class="needles">
<? foreach ($needles as $needle): ?>
+ <? $hash = md5($url . '|' . $needle['name']) ?>
<li <? if ($needle['quick_search'] && $needle['quick_search']->hasExtendedLayout()) echo 'class="extendedLayout" id="' . $needle['quick_search']->getId() . '_frame"'; ?>>
<div class="input-group files-search">
- <label for="needle-<?= $hash = md5($url . '|' . $needle['name']) ?>" <? if ($needle['placeholder']) echo 'style="display:none;"'; ?>>
+ <label for="needle-<?= $hash ?>" <? if ($needle['placeholder']) echo 'style="display:none;"'; ?>>
<?= htmlReady($needle['label']) ?>
</label>
<? if ($needle['quick_search']): ?>
@@ -23,10 +25,19 @@
<?= arrayToHtmlAttributes($needle['attributes']) ?>>
<? endif; ?>
<? if ($reset_link): ?>
- <a class="reset-search" href="<?= $reset_link ?>" tabindex="0" role="button"
- title="<?= _('Suche zurücksetzen') ?>">
- <?= Icon::create('decline')->asImg(20) ?>
- </a>
+ <? if ($onsubmit) : ?>
+ <?= Icon::create('decline')->asInput([
+ 'title' => _('Suche zurücksetzen'),
+ 'class' => 'reset-search',
+ 'onclick' => "window.document.getElementById('needle-".$hash."').value = '';"
+ ]) ?>
+ <? else : ?>
+ <a class="reset-search" href="<?= $reset_link ?>" tabindex="0" role="button"
+ <?= $onsubmit ? 'onclick="'."window.document.getElementById('needle-".$hash."').value = ''; window.document.getElementById('".$id."').submit(); return false; ".'"' : '' ?>
+ title="<?= _('Suche zurücksetzen') ?>">
+ <?= Icon::create('decline')->asImg(20) ?>
+ </a>
+ <? endif ?>
<? endif; ?>
<button type="submit" class="submit-search<?= $reset_link ? ' is-executed' : '' ?>"
title="<?= _('Suche ausführen') ?>">