added filter to privilege dropdowns

This commit is contained in:
Jottyfan 2023-05-06 20:39:34 +02:00
parent d1ee923f0a
commit 5b861f730f
4 changed files with 20 additions and 4 deletions

View File

@ -18,7 +18,7 @@ apply plugin: 'war'
apply plugin: 'application' apply plugin: 'application'
group = 'de.jottyfan.camporganizer' group = 'de.jottyfan.camporganizer'
version = '0.5.0' version = '0.5.1'
sourceCompatibility = 17 sourceCompatibility = 17
mainClassName = "de.jottyfan.camporganizer.Main" mainClassName = "de.jottyfan.camporganizer.Main"

View File

@ -6,3 +6,17 @@ class MyToggle {
$("[id='" + divid + "']").toggle(); $("[id='" + divid + "']").toggle();
} }
} }
filterAllOfClass = function(filterselector, haystackselector) {
$(haystackselector).each(function() {
var t = $($(this).children()[0]).text();
var filter = $(filterselector).val();
if (filter == '' || filter == '*') {
$(this).show();
} else if (t.toUpperCase().indexOf(filter.toUpperCase()) > -1) {
$(this).show();
} else {
$(this).hide();
}
});
}

View File

@ -13,7 +13,8 @@
<span th:text="${selected}" th:if="${selected}"></span> <span th:unless="${selected}">-- bitte wählen --</span> <span th:text="${selected}" th:if="${selected}"></span> <span th:unless="${selected}">-- bitte wählen --</span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li th:each="e : ${list}"><a class="dropdown-item" th:href="@{/admin/privileges/campbased/{r}(r=${e.pk})}"><span th:text="${e.fullname}"></span></a></li> <li style="padding: 8px"><input type="text" id="needle" onkeyup="filterAllOfClass('#needle', '.haystack')" placeholder="Filter" class="form-control" /></li>
<li th:each="e : ${list}" class="haystack"><a class="dropdown-item" th:href="@{/admin/privileges/campbased/{r}(r=${e.pk})}" th:text="${e.fullname}"></a></li>
</ul> </ul>
</div> </div>
<div class="card" th:if="${selected}"> <div class="card" th:if="${selected}">

View File

@ -13,7 +13,8 @@
<span th:text="${selected}" th:if="${selected}"></span> <span th:unless="${selected}">-- bitte wählen --</span> <span th:text="${selected}" th:if="${selected}"></span> <span th:unless="${selected}">-- bitte wählen --</span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li th:each="e : ${list}"><a class="dropdown-item" th:href="@{/admin/privileges/userbased/{r}(r=${e.pk})}"><span th:text="${e.fullname}"></span></a></li> <li style="padding: 8px"><input type="text" id="needle" onkeyup="filterAllOfClass('#needle', '.haystack')" placeholder="Filter" class="form-control" /></li>
<li th:each="e : ${list}" class="haystack"><a class="dropdown-item" th:href="@{/admin/privileges/userbased/{r}(r=${e.pk})}" th:text="${e.fullname}"></a></li>
</ul> </ul>
</div> </div>
<div class="card" th:if="${selected}"> <div class="card" th:if="${selected}">