Added user menus viewlet
authorThierry Florac <thierry.florac@onf.fr>
Mon, 18 Jan 2016 18:38:12 +0100
changeset 111 6afd6d3ad000
parent 110 e575b6ab5745
child 112 542aebb75317
Added user menus viewlet
src/pyams_skin/viewlet/menu/__init__.py
src/pyams_skin/viewlet/menu/user-menus.pt
--- a/src/pyams_skin/viewlet/menu/__init__.py	Mon Jan 18 18:37:46 2016 +0100
+++ b/src/pyams_skin/viewlet/menu/__init__.py	Mon Jan 18 18:38:12 2016 +0100
@@ -15,7 +15,8 @@
 # import standard library
 
 # import interfaces
-from pyams_skin.interfaces.viewlet import IMainMenusViewletManager, IMenu, IMenuItem, IMenuHeader
+from pyams_skin.interfaces.viewlet import IMainMenusViewletManager, IUserMenusViewletManager, IMenu, IMenuItem, \
+    IMenuHeader
 from pyams_skin.layer import IPyAMSLayer
 
 # import packages
@@ -37,6 +38,16 @@
 
 
 #
+# User menus viewlet manager
+#
+
+@viewletmanager_config(name='pyams.user_menus', layer=IPyAMSLayer, provides=IUserMenusViewletManager)
+@template_config(template='user-menus.pt', layer=IPyAMSLayer)
+class UserMenusViewletManager(TemplateBasedViewletManager, WeightOrderedViewletManager):
+    """User menus viewlet manager"""
+
+
+#
 # Menus group
 #
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_skin/viewlet/menu/user-menus.pt	Mon Jan 18 18:38:12 2016 +0100
@@ -0,0 +1,4 @@
+<ul class="dropdown-menu pull-right">
+	<li tal:repeat="viewlet view.viewlets"
+		tal:replace="structure viewlet.render()"></li>
+</ul>