[tabs] fix pb with non-lazy tabs: style isn't properly set due to missing jquery.ui activation. Closes #2465657 stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 30 Aug 2012 17:07:59 +0200
branchstable
changeset 8531 e150b4bcbfaa
parent 8530 2bceea9dee95
child 8532 28a346df670e
[tabs] fix pb with non-lazy tabs: style isn't properly set due to missing jquery.ui activation. Closes #2465657 also do a small cleanup on the way, and properly implements render_entity rather than cell_call, as one would expect regarding default PrimaryView code.
web/views/tabs.py
--- a/web/views/tabs.py	Tue Sep 04 06:52:41 2012 +0200
+++ b/web/views/tabs.py	Thu Aug 30 17:07:59 2012 +0200
@@ -171,7 +171,7 @@
         # XXX make work history: true
         if self.lazy:
             self._cw.add_onload(u"""
-  jQuery('#entity-tabs-%(eeid)s').tabs(
+  jQuery('#entity-tabs-%(uid)s').tabs(
     { selected: %(tabindex)s,
       select: function(event, ui) {
         setTab(ui.panel.id, '%(cookiename)s');
@@ -179,9 +179,13 @@
     });
   setTab('%(domid)s', '%(cookiename)s');
 """ % {'tabindex'   : active_tab_idx,
-       'domid'        : active_tab,
-       'eeid'       : (entity and entity.eid or uid),
+       'domid'      : active_tab,
+       'uid'        : uid,
        'cookiename' : self.cookie_name})
+        else:
+            self._cw.add_onload(
+                u"jQuery('#entity-tabs-%(uid)s').tabs({selected: %(tabindex)s});"
+                % {'tabindex': active_tab_idx, 'uid': uid})
 
 
 class EntityRelationView(EntityView):
@@ -222,8 +226,7 @@
     tabs = [_('main_tab')]
     default_tab = 'main_tab'
 
-    def cell_call(self, row, col):
-        entity = self.cw_rset.complete_entity(row, col)
+    def render_entity(self, entity):
         self.render_entity_toolbox(entity)
         self.w(u'<div class="tabbedprimary"></div>')
         self.render_entity_title(entity)