diff libervia/pages/lists/view_item/page_meta.py @ 1468:e85ef5f3515e

pages (lists/view_item): add current list to breadcrumbs
author Goffi <goffi@goffi.org>
date Fri, 01 Oct 2021 12:12:30 +0200
parents 8ac062d2ff8b
children 837ae0c4b858
line wrap: on
line diff
--- a/libervia/pages/lists/view_item/page_meta.py	Thu Sep 30 18:40:49 2021 +0200
+++ b/libervia/pages/lists/view_item/page_meta.py	Fri Oct 01 12:12:30 2021 +0200
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 
 from twisted.words.protocols.jabber import jid
-from sat.core.i18n import _
+from sat.core.i18n import _, D_
 from sat.tools.common import template_xmlui
 from sat.tools.common import uri
 from sat.tools.common import data_format
@@ -26,6 +26,20 @@
         log.warning(_("no list item id specified"))
         self.pageError(request, C.HTTP_BAD_REQUEST)
 
+
+def add_breadcrumb(self, request, breadcrumbs):
+    data = self.getRData(request)
+    list_url = self.getPageByName("lists").getURL(data["service"].full(),
+                                                  data.get("node") or "@")
+    breadcrumbs.append({
+        "label": D_("List"),
+        "url": list_url
+    })
+    breadcrumbs.append({
+        "label": D_("item"),
+    })
+
+
 async def prepare_render(self, request):
     data = self.getRData(request)
     template_data = request.template_data
@@ -52,7 +66,7 @@
         {"labels_as_list": C.BOOL_TRUE},
         profile,
     )
-    list_items, metadata = data_format.deserialise(list_raw, type_check=list)
+    list_items, __ = data_format.deserialise(list_raw, type_check=list)
     list_item = [template_xmlui.create(self.host, x) for x in list_items][0]
     template_data["item"] = list_item
     try: