summaryrefslogtreecommitdiff
path: root/admin
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-06-21 09:20:54 +0200
committerRaindropsSys <contact@minteck.org>2023-06-21 09:20:54 +0200
commit26cba590b239f799b35cb868bf7037174831f742 (patch)
tree0302abb6b5b85bd21f5bf9a09c085bf6e5e23622 /admin
parent9441896b3e55e0985be0ce5e690cab0d19bee253 (diff)
downloaddelta-26cba590b239f799b35cb868bf7037174831f742.tar.gz
delta-26cba590b239f799b35cb868bf7037174831f742.tar.bz2
delta-26cba590b239f799b35cb868bf7037174831f742.zip
Updated 6 files and added 2 files (automated)
Diffstat (limited to 'admin')
-rw-r--r--admin/objects/index.php49
1 files changed, 46 insertions, 3 deletions
diff --git a/admin/objects/index.php b/admin/objects/index.php
index e910025..735e4e2 100644
--- a/admin/objects/index.php
+++ b/admin/objects/index.php
@@ -72,6 +72,10 @@ usort($keys, function ($a, $b) {
grid-template-columns: 1fr 2fr 0 !important;
}
}
+
+ .filteredOut {
+ display: none !important;
+ }
</style>
<div class="container">
@@ -80,11 +84,30 @@ usort($keys, function ($a, $b) {
<h1><?= l("lang_admin_titles_objects") ?></h1>
<script src="/fuse.php"></script>
- <input style="margin-bottom: 15px;" id="search" autocapitalize="none" autocomplete="off" spellcheck="false" autofocus class="form-control" placeholder="<?= l("lang_admin_search") ?>" value="" onkeyup="search();" onkeydown="search();" onchange="search();">
+ <div class="input-group">
+ <select onchange="updateFilter();" style="height: 100%;" class="form-select" id="filter">
+ <option value="" selected><?= l("lang_admin_types_all") ?></option>
+ <option value="articles"><?= l("lang_admin_types2_articles") ?></option>
+ <option value="gallery"><?= l("lang_admin_types2_gallery") ?></option>
+ <option value="people"><?= l("lang_admin_types2_people") ?></option>
+ <option value="profiles"><?= l("lang_admin_types2_profiles") ?></option>
+ <option value="requests"><?= l("lang_admin_types2_requests") ?></option>
+ </select>
+ <script>
+ document.getElementById("filter").value = "";
+ </script>
+ <input style="width: 50%; margin-bottom: 15px;" id="search" autocapitalize="none" autocomplete="off" spellcheck="false" autofocus class="form-control" placeholder="<?= l("lang_admin_search") ?>" value="" onkeyup="search();" onkeydown="search();" onchange="search();">
+ </div>
<div class="list-group" id="all-items">
<?php $entries = []; foreach ($keys as $item): $entries[] = ["id" => $item["id"], "name" => $item["name"] ?? null]; ?>
- <a id="search-result-<?= $item["id"] ?>" class="search-result list-group-item list-group-item-action" href="/admin/edit/?id=<?= $item["id"] ?>" style="display: grid; grid-template-columns: 1fr 2fr 2fr; grid-gap: 10px;">
+ <a id="search-result-<?= $item["id"] ?>" class="search-result list-group-item list-group-item-action <?= match ($item["type"]) {
+ "articles" => "item-articles",
+ "gallery" => "item-gallery",
+ "people" => "item-people",
+ "profiles" => "item-profiles",
+ "requests" => "item-requests",
+ } ?>" href="/admin/edit/?id=<?= $item["id"] ?>" style="display: grid; grid-template-columns: 1fr 2fr 2fr; grid-gap: 10px;">
<?= match ($item["type"]) {
"articles" => "<span style='width: max-content; display: flex; height: max-content; align-self: center;' class='badge bg-success rounded-pill'>" . l("lang_admin_types_articles") . "</span>",
"gallery" => "<span style='width: max-content; display: flex; height: max-content; align-self: center;' class='badge bg-success rounded-pill'>" . l("lang_admin_types_gallery") . "</span>",
@@ -104,7 +127,7 @@ usort($keys, function ($a, $b) {
</button>
<ul class="dropdown-menu">
<?php foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/skels"), function ($i) { return !str_starts_with($i, "."); }) as $skel): $id = substr($skel, 0, -5); ?>
- <li><a class="dropdown-item" href="/admin/create/?skel=<?= $id ?>"><?= $id ?></a></li>
+ <li><a class="dropdown-item" href="/admin/create/?skel=<?= $id ?>"><?= l("lang_admin_types_" . $id) ?></a></li>
<?php endforeach; ?>
</ul>
</div>
@@ -138,6 +161,26 @@ usort($keys, function ($a, $b) {
document.getElementById("search-results").innerHTML = fuse.search(query).map(i => i.item.id).map(i => document.getElementById("search-result-" + i).outerHTML).join("");
}
+
+ function updateFilter() {
+ let filter = document.getElementById("filter").value;
+
+ if (filter === "") {
+ for (let item of Array.from(document.getElementsByClassName("search-result"))) {
+ item.classList.remove("filteredOut");
+ }
+ } else {
+ for (let item of Array.from(document.getElementsByClassName("search-result"))) {
+ item.classList.remove("filteredOut");
+ }
+
+ for (let item of Array.from(document.getElementsByClassName("search-result"))) {
+ if (!item.classList.contains("item-" + filter)) {
+ item.classList.add("filteredOut");
+ }
+ }
+ }
+ }
</script>
<br><br>