Expose the identifier of a menu item
authorAlexander Ebert <ebert@woltlab.com>
Wed, 29 Jun 2022 15:32:48 +0000 (17:32 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 29 Jun 2022 15:32:48 +0000 (17:32 +0200)
ts/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.ts
ts/WoltLabSuite/Core/Ui/Page/Menu/Main/Frontend.ts
ts/WoltLabSuite/Core/Ui/Page/Menu/Main/Provider.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/Main/Frontend.js

index 8a8e576e5403af8ac0237b6be90db1acfb24be61..d7268e4964063c2987cdab650e88287e01259a09 100644 (file)
@@ -20,6 +20,7 @@ function getSubMenuItems(subMenu: HTMLElement, menuItem: string): MenuItem[] {
       children,
       counter: 0,
       depth: 1,
+      identifier: false,
       title,
     };
   });
@@ -39,6 +40,7 @@ function getMenuItems(category: HTMLOListElement): MenuItem[] {
       children,
       counter: 0,
       depth: 2,
+      identifier: false,
       link: link.href,
       title: link.textContent!,
     };
@@ -57,6 +59,7 @@ function getMenuItemActions(link: HTMLAnchorElement): MenuItem[] {
       children: [],
       counter: 0,
       depth: 2,
+      identifier: false,
       link: action.href,
       title: action.dataset.tooltip || action.title,
     };
@@ -79,6 +82,7 @@ export class AcpUiPageMenuMainBackend implements PageMenuMainProvider {
           children,
           counter: 0,
           depth: 0,
+          identifier: false,
           title,
         };
       },
index 17043aab8a828a121ce3a9ec3558b5af5d3391e0..3409ca7501bb6afa06cfc2820a712c11e18bc0b5 100644 (file)
@@ -41,11 +41,14 @@ function normalizeMenuItem(menuItem: HTMLElement, depth: MenuItemDepth): MenuIte
 
   const active = menuItem.classList.contains("active");
 
+  const identifier = anchor.parentElement!.dataset.identifier!;
+
   return {
     active,
     children,
     counter,
     depth,
+    identifier,
     link,
     title,
   };
index 6ffdd83727ba8c6f9a5531172761f2853b58c3d7..96b153515889e5db1f5f2130b539f220dee2eb6d 100644 (file)
@@ -16,6 +16,7 @@ export type MenuItem = {
   children: MenuItem[];
   counter: number;
   depth: MenuItemDepth;
+  identifier: string | false;
   link?: string;
   title: string;
 };
index 43ba1d4373ca12d280c6a90ce6e898ffe0aea42a..1fcc63ac03faf113c462d6db069b3d5d44fc62cc 100644 (file)
@@ -20,6 +20,7 @@ define(["require", "exports"], function (require, exports) {
                 children,
                 counter: 0,
                 depth: 1,
+                identifier: false,
                 title,
             };
         });
@@ -36,6 +37,7 @@ define(["require", "exports"], function (require, exports) {
                 children,
                 counter: 0,
                 depth: 2,
+                identifier: false,
                 link: link.href,
                 title: link.textContent,
             };
@@ -52,6 +54,7 @@ define(["require", "exports"], function (require, exports) {
                 children: [],
                 counter: 0,
                 depth: 2,
+                identifier: false,
                 link: action.href,
                 title: action.dataset.tooltip || action.title,
             };
@@ -70,6 +73,7 @@ define(["require", "exports"], function (require, exports) {
                     children,
                     counter: 0,
                     depth: 0,
+                    identifier: false,
                     title,
                 };
             });
index 913eedce4dee11a0b6419c39f31d8b2dd7f053bf..3ca79e3e7f31ce4d11084a7fb7460be2ffd12ab7 100644 (file)
@@ -36,11 +36,13 @@ define(["require", "exports"], function (require, exports) {
             link = anchor.href;
         }
         const active = menuItem.classList.contains("active");
+        const identifier = anchor.parentElement.dataset.identifier;
         return {
             active,
             children,
             counter,
             depth,
+            identifier,
             link,
             title,
         };