comparison libervia/pages/blog/view/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 cffa3ae4d0aa
children 907f519faaf0 cff720e26089
comparison
equal deleted inserted replaced
1418:d6bcb0cf92d2 1419:6fc41f000d24
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 2
3 import html 3 import html
4 from libervia.server.constants import Const as C 4 from libervia.server.constants import Const as C
5 from twisted.words.protocols.jabber import jid 5 from twisted.words.protocols.jabber import jid
6 from sat.core.i18n import _ 6 from sat.core.i18n import _, D_
7 from sat.tools.common.template import safe 7 from sat.tools.common.template import safe
8 from sat.tools.common import uri 8 from sat.tools.common import uri
9 from sat.tools.common import data_format 9 from sat.tools.common import data_format
10 from sat.tools.common import regex 10 from sat.tools.common import regex
11 from sat.core.log import getLogger 11 from sat.core.log import getLogger
100 "type": "application/atom+xml", 100 "type": "application/atom+xml",
101 "rel": "alternate", 101 "rel": "alternate",
102 "title": "{service}'s blog".format(service=service)}) 102 "title": "{service}'s blog".format(service=service)})
103 103
104 104
105 def add_breadcrumb(self, request, breadcrumbs):
106 data = self.getRData(request)
107 breadcrumbs.append({
108 "label": D_("Feed"),
109 "url": self.getURL(data["service"].full(), data.get("node", "@"))
110 })
111 if "item" in data:
112 breadcrumbs.append({
113 "label": D_("Post"),
114 })
115
116
105 async def appendComments(self, request, blog_items, profile): 117 async def appendComments(self, request, blog_items, profile):
106 await self.fillMissingIdentities( 118 await self.fillMissingIdentities(
107 request, [i['author_jid'] for i in blog_items['items']]) 119 request, [i['author_jid'] for i in blog_items['items']])
108 for blog_item in blog_items['items']: 120 for blog_item in blog_items['items']:
109 for comment_data in blog_item['comments']: 121 for comment_data in blog_item['comments']: