Added javascript toolbar action
authorThierry Florac <thierry.florac@onf.fr>
Mon, 02 Oct 2017 14:46:17 +0200
changeset 220 ec15e26aad80
parent 219 0caa978bb958
child 221 2adefb399b79
Added javascript toolbar action
src/pyams_skin/viewlet/toolbar/__init__.py
src/pyams_skin/viewlet/toolbar/action.pt
--- a/src/pyams_skin/viewlet/toolbar/__init__.py	Mon Oct 02 14:45:50 2017 +0200
+++ b/src/pyams_skin/viewlet/toolbar/__init__.py	Mon Oct 02 14:46:17 2017 +0200
@@ -62,6 +62,13 @@
         return absolute_url(self.context, self.request, self.url)
 
 
+class JsToolbarAction(ToolbarAction):
+    """Javascript toolbar action"""
+
+    def get_url(self):
+        return self.url
+
+
 @template_config(template='menu.pt', layer=IPyAMSLayer)
 @implementer(IToolbarMenu)
 class ToolbarMenu(TemplateBasedViewletManager, WeightOrderedViewletManager, Viewlet):
--- a/src/pyams_skin/viewlet/toolbar/action.pt	Mon Oct 02 14:45:50 2017 +0200
+++ b/src/pyams_skin/viewlet/toolbar/action.pt	Mon Oct 02 14:46:17 2017 +0200
@@ -1,6 +1,6 @@
 <div class="btn-group">
 	<button tal:attributes="class view.css_class;
-							data-toggle 'modal' if view.modal_target else '';
+							data-toggle 'modal' if view.modal_target else None;
 							data-ams-url view.get_url()">
 		<i tal:attributes="class view.label_css_class"></i>&nbsp;
 		<tal:var content="view.label" />