diff libervia/pages/files/list/page_meta.py @ 1419:6fc41f000d24

pages (blog/view, u, files/list): custom breadcrumbs: - for `blog/view`, feed is added, then post if an item is shown - for `files/list`, files server then directories (with icons) are used - for `u` we deactivate breadcrumb for now
author Goffi <goffi@goffi.org>
date Thu, 29 Apr 2021 20:51:36 +0200
parents 886d1856e9de
children e065c8886b81
line wrap: on
line diff
--- a/libervia/pages/files/list/page_meta.py	Thu Apr 29 20:49:32 2021 +0200
+++ b/libervia/pages/files/list/page_meta.py	Thu Apr 29 20:51:36 2021 +0200
@@ -22,6 +22,21 @@
     self.getPathArgs(request, ["service", "*path"], min_args=1, service="jid", path="")
 
 
+def add_breadcrumb(self, request, breadcrumbs):
+    data = self.getRData(request)
+    breadcrumbs.append({
+        "label": data["service"],
+        "url": self.getURL(data["service"].full()),
+        "icon": "server",
+    })
+    for idx, p in enumerate(data["path"]):
+        breadcrumbs.append({
+            "label": p,
+            "url": self.getURL(data["service"].full(), *data["path"][:idx+1]),
+            "icon": "folder-open-empty",
+        })
+
+
 async def prepare_render(self, request):
     data = self.getRData(request)
     thumb_limit = data.get("thumb_limit", 400)