web/views/tabs.py
branchtreeview-tabs
changeset 997 ee71c2ba73e6
parent 917 51d5224b1698
child 999 999198995a53
equal deleted inserted replaced
931:7b701df4dbef 997:ee71c2ba73e6
     1 """base classes to handle tabbed views
     1 """base classes to handle tabbed views
     2 
     2 
     3 :organization: Logilab
     3 :organization: Logilab
     4 :copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     4 :copyright: 2008-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 """
     6 """
     7 
     7 
     8 __docformat__ = "restructuredtext en"
     8 __docformat__ = "restructuredtext en"
     9 
     9 
    95 
    95 
    96     def render_tabs(self, tabs, default, entity):
    96     def render_tabs(self, tabs, default, entity):
    97         self.req.add_css('ui.tabs.css')
    97         self.req.add_css('ui.tabs.css')
    98         self.req.add_js(('ui.core.js', 'ui.tabs.js',
    98         self.req.add_js(('ui.core.js', 'ui.tabs.js',
    99                          'cubicweb.ajax.js', 'cubicweb.tabs.js', 'cubicweb.lazy.js'))
    99                          'cubicweb.ajax.js', 'cubicweb.tabs.js', 'cubicweb.lazy.js'))
       
   100         # tabbed views do no support concatenation
       
   101         # hence we delegate to the default tab
       
   102         if self.req.form.get('vid') == 'primary':
       
   103             entity.view(default)
       
   104             return
   100         # prune tabs : not all are to be shown
   105         # prune tabs : not all are to be shown
   101         tabs = self.prune_tabs(tabs)
   106         tabs = self.prune_tabs(tabs)
   102         # select a tab
   107         # select a tab
   103         active_tab = self.active_tab(tabs, default)
   108         active_tab = self.active_tab(tabs, default)
   104         # build the html structure
   109         # build the html structure