src/pyams_skin/viewlet/toolbar/__init__.py
changeset 61 ecc79f7c5957
parent 25 23d78e06822d
child 69 a361355b55c7
--- a/src/pyams_skin/viewlet/toolbar/__init__.py	Wed May 20 12:33:19 2015 +0200
+++ b/src/pyams_skin/viewlet/toolbar/__init__.py	Wed May 20 12:33:54 2015 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_skin.interfaces.container import ITable, ITableWithActions
+from pyams_skin.interfaces.container import ITableWithActions
 from pyams_skin.interfaces.viewlet import IToolbarViewletManager, IToolbarAction, IToolbarMenu, IToolbarMenuItem, \
     IContextActions, IToolbarAddingMenu, ITableItemColumnActionsMenu
 from pyams_skin.layer import IPyAMSLayer
@@ -84,8 +84,8 @@
         return Viewlet.render(self)
 
 
-@viewlet_config(name='pyams.addings', view=ITable, layer=IPyAMSLayer, manager=IToolbarViewletManager)
-@viewletmanager_config(name='pyams.addings', view=ITable, layer=IPyAMSLayer, provides=IToolbarAddingMenu)
+@viewlet_config(name='pyams.addings', view=Interface, layer=IPyAMSLayer, manager=IToolbarViewletManager)
+@viewletmanager_config(name='pyams.addings', view=Interface, layer=IPyAMSLayer, provides=IToolbarAddingMenu)
 @implementer(IToolbarAddingMenu)
 class ToolbarAddingMenu(ToolbarMenu):
     """Toolbar adding menu"""
@@ -120,6 +120,13 @@
         return absolute_url(self.context, self.request, self.url)
 
 
+class JsToolbarMenuItem(ToolbarMenuItem):
+    """Javascript call toolbar menu item"""
+
+    def get_url(self):
+        return self.url
+
+
 @template_config(template='menu-divider.pt', layer=IPyAMSLayer)
 @implementer(IToolbarMenuItem)
 class ToolbarMenuDivider(Viewlet):
@@ -142,7 +149,7 @@
 class ContextActionsExtension(ContextRequestViewAdapter):
     """extension:context_actions(context) TALES extension"""
 
-    def render(self, context):
+    def render(self, context=None):
         if context is None:
             context = self.context
         registry = self.request.registry