--- a/src/pyams_content/skin/zmi/viewlet/toplinks/__init__.py Thu Apr 12 17:45:09 2018 +0200
+++ b/src/pyams_content/skin/zmi/viewlet/toplinks/__init__.py Thu Apr 12 18:26:22 2018 +0200
@@ -57,20 +57,41 @@
self.viewlets.append(menu)
-@viewlet_config(name='shared-tools.menu', layer=IAdminLayer, manager=ITopLinksViewletManager, weight=30)
-class SharedToolsMenu(TopLinksViewlet):
- """Shared tools menu"""
+@viewlet_config(name='shared-contents.menu', layer=IAdminLayer, manager=ITopLinksViewletManager, weight=30)
+class SharedContentsMenu(TopLinksViewlet):
+ """Shared contents menu"""
label = ''
css_class = 'top-menu bordered margin-top-10'
dropdown_label = _("Shared contents")
def update(self):
+ super(SharedContentsMenu, self).update()
+ registry = get_local_registry()
+ for tool in sorted(registry.getAllUtilitiesRegisteredFor(IBaseSharedTool),
+ key=lambda x: II18n(x).query_attribute('title', request=self.request) or ''):
+ if ISharedSite.providedBy(tool) or (not tool.shared_content_menu):
+ continue
+ menu = TopLinksMenu(self.context, self.request, self.__parent__, self)
+ menu.label = II18n(tool).query_attribute('title', request=self.request) or tool.__name__
+ menu.url = absolute_url(tool, self.request, 'admin#dashboard.html')
+ self.viewlets.append(menu)
+
+
+@viewlet_config(name='shared-tools.menu', layer=IAdminLayer, manager=ITopLinksViewletManager, weight=40)
+class SharedToolsMenu(TopLinksViewlet):
+ """Shared tools menu"""
+
+ label = ''
+ css_class = 'top-menu bordered margin-top-10'
+ dropdown_label = _("Shared tools")
+
+ def update(self):
super(SharedToolsMenu, self).update()
registry = get_local_registry()
for tool in sorted(registry.getAllUtilitiesRegisteredFor(IBaseSharedTool),
key=lambda x: II18n(x).query_attribute('title', request=self.request) or ''):
- if ISharedSite.providedBy(tool):
+ if ISharedSite.providedBy(tool) or tool.shared_content_menu:
continue
menu = TopLinksMenu(self.context, self.request, self.__parent__, self)
menu.label = II18n(tool).query_attribute('title', request=self.request) or tool.__name__