Added optional target on menu items
authorThierry Florac <thierry.florac@onf.fr>
Thu, 06 Oct 2016 16:18:03 +0200
changeset 154 9802f640c418
parent 153 6a846ca3ba84
child 155 cd3ab32436f0
Added optional target on menu items
src/pyams_skin/interfaces/viewlet.py
src/pyams_skin/viewlet/menu/__init__.py
src/pyams_skin/viewlet/menu/menu-item.pt
--- a/src/pyams_skin/interfaces/viewlet.py	Thu Oct 06 15:44:22 2016 +0200
+++ b/src/pyams_skin/interfaces/viewlet.py	Thu Oct 06 16:18:03 2016 +0200
@@ -196,6 +196,9 @@
                    required=False,
                    default=u'#')
 
+    target = TextLine(title="Menu link window target",
+                      required=False)
+
     modal_target = Bool(title="Modal target",
                         required=False,
                         default=False)
--- a/src/pyams_skin/viewlet/menu/__init__.py	Thu Oct 06 15:44:22 2016 +0200
+++ b/src/pyams_skin/viewlet/menu/__init__.py	Thu Oct 06 16:18:03 2016 +0200
@@ -96,6 +96,7 @@
     notice_class = FieldProperty(IMenuItem['notice_class'])
     click_handler = FieldProperty(IMenuItem['click_handler'])
     url = FieldProperty(IMenuItem['url'])
+    target = FieldProperty(IMenuItem['target'])
     modal_target = FieldProperty(IMenuItem['modal_target'])
     data = FieldProperty(IMenuItem['data'])
 
@@ -134,6 +135,7 @@
     notice_class = None
     click_handler = None
     url = None
+    target = None
     modal_target = False
     data = None
 
--- a/src/pyams_skin/viewlet/menu/menu-item.pt	Thu Oct 06 15:44:22 2016 +0200
+++ b/src/pyams_skin/viewlet/menu/menu-item.pt	Thu Oct 06 16:18:03 2016 +0200
@@ -1,6 +1,7 @@
 <li tal:attributes="class view.css_class">
 	<a tal:condition="view.label"
 	   tal:attributes="href view.get_url();
+					   target view.target;
 					   data-toggle 'modal' if view.modal_target else None;
 					   title view.label;
 					   data-ams-data extension:object_data(view);">