commit 802b03def520701f48901e4b7eb8946cfc0efde5
parent 47c28256f3729313854422849fdd9581a5af373a
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Fri, 20 Dec 2024 12:25:49 +0100
feat: show all categories below current note
Diffstat:
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/config/i18n.php b/config/i18n.php
@@ -15,6 +15,7 @@ if ($lang == "en") {
     $GLOBALS["i18n_note"] = "Note";
     $GLOBALS["i18n_notes"] = "Notes";
     $GLOBALS["i18n_category"] = "Category";
+    $GLOBALS["i18n_categories"] = "Categories";
     $GLOBALS["i18n_filename"] = "File name";
     $GLOBALS["i18n_save"] = "Save note";
     $GLOBALS["i18n_edit"] = "Edit note";
@@ -26,7 +27,6 @@ if ($lang == "en") {
     $GLOBALS["i18n_pass"] = "Password";
     $GLOBALS["i18n_noauth"] = "You could not be authenticated. Please login and try again!";
     $GLOBALS["i18n_logout"] = "Logout";
-    $GLOBALS["i18n_categories"] = "Categories";
     $GLOBALS["i18n_delete"] = "Delete";
     $GLOBALS["i18n_cookie"] = "Keep me logged in! (this will set a cookie)";
     $GLOBALS["i18n_cookie_session"] = "No, only temporarily";
diff --git a/lib/show.php b/lib/show.php
@@ -118,6 +118,57 @@ function show_note(
 
     } // if-statement
 
+?>
+
+<!-- all other categories -->
+
+<div class="categories">
+
+    <stretch><?php echo $GLOBALS["i18n_categories"]; ?>:</stretch><br>
+
+
+<?php
+    $categories = gather_categories($user);
+    foreach ($categories as $category) {
+
+        /* Skip empty categories */
+        if ($category["matches"] < 1) {
+            continue;
+        }
+
+        /* construct button label */
+        $cat_label = $category["name"] . " (" . $category["matches"] . ")";
+?>
+
+    <!-- other category button -->
+    <form action="/" method="post" class="inline">
+        <input
+            id="category"
+            name="category"
+            type="hidden"
+            value="<?php echo $category["name"]; ?>"
+        >
+        <input
+            id="action"
+            name="action"
+            type="hidden"
+            value="list"
+        >
+        <input
+            class="likenavitem"
+            type="submit"
+            value="<?php echo $cat_lab; ?>"
+        >
+    </form>
+
+<?php
+    } // foreach loop
+?>
+
+</div>
+
+<?php
+
 } // function
 
 ?>