allow user to give ?tab=tabname and be set to the right tab (part of #345399) 3.5
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Mon, 14 Sep 2009 14:59:23 +0200
branch3.5
changeset 3209 c2c8f88a4520
parent 3203 1366cacd5387
child 3210 44fa8d4a25d5
allow user to give ?tab=tabname and be set to the right tab (part of #345399)
web/views/tabs.py
--- a/web/views/tabs.py	Mon Sep 14 11:38:30 2009 +0200
+++ b/web/views/tabs.py	Mon Sep 14 14:59:23 2009 +0200
@@ -71,6 +71,9 @@
         return str('%s_active_tab' % self.config.appid)
 
     def active_tab(self, tabs, default):
+        formtab = self.req.form.get('tab')
+        if formtab in tabs:
+            return formtab
         cookies = self.req.get_cookie()
         cookiename = self.cookie_name
         activetab = cookies.get(cookiename)
@@ -112,7 +115,7 @@
         w(u'<ul>')
         for tab in tabs:
             w(u'<li>')
-            w(u'<a href="#as-%s">' % tab)
+            w(u'<a href="#%s">' % tab)
             w(u'<span onclick="set_tab(\'%s\', \'%s\')">' % (tab, self.cookie_name))
             w(self.req._(tab))
             w(u'</span>')
@@ -121,7 +124,7 @@
         w(u'</ul>')
         w(u'</div>')
         for tab in tabs:
-            w(u'<div id="as-%s">' % tab)
+            w(u'<div id="%s">' % tab)
             if entity:
                 self.lazyview(tab, eid=entity.eid)
             else:
@@ -153,7 +156,7 @@
         role = 'subject'
         vid = 'gallery'
 
-    in this example, entities related to project entity by the'screenshot'
+    in this example, entities related to project entity by the 'screenshot'
     relation (where the project is subject of the relation) will be displayed
     using the 'gallery' view.
     """