[tabs] fix clic on tab that does nothing (closes #1942750) stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Wed, 21 Sep 2011 19:00:49 +0200
branchstable
changeset 7819 93d9a9c29bfb
parent 7818 be4a3e97090d
child 7820 2c73fc529a20
[tabs] fix clic on tab that does nothing (closes #1942750) (there was an area around the text that would trigger the tab switch but not load the tab content)
web/views/tabs.py
--- a/web/views/tabs.py	Wed Sep 21 18:35:45 2011 +0200
+++ b/web/views/tabs.py	Wed Sep 21 19:00:49 2011 +0200
@@ -140,9 +140,7 @@
         for i, (tabid, domid, tabkwargs) in enumerate(tabs):
             w(u'<li>')
             w(u'<a href="#%s">' % domid)
-            w(u'<span onclick="%s">' % xml_escape(unicode(uilib.js.setTab(domid, self.cookie_name))))
             w(tabkwargs.pop('label', self._cw._(tabid)))
-            w(u'</span>')
             w(u'</a>')
             w(u'</li>')
             if domid == active_tab:
@@ -160,7 +158,12 @@
         # because the callback binding needs to be done before
         # XXX make work history: true
         self._cw.add_onload(u"""
-  jQuery('#entity-tabs-%(eeid)s').tabs( { selected: %(tabindex)s });
+  jQuery('#entity-tabs-%(eeid)s').tabs(
+    { selected: %(tabindex)s,
+      select: function(event, ui) {
+        setTab(ui.panel.id, '%(cookiename)s');
+      }
+    });
   setTab('%(domid)s', '%(cookiename)s');
 """ % {'tabindex'   : active_tab_idx,
        'domid'        : active_tab,