web/views/tabs.py
branchtls-sprint
changeset 1263 01152fffd593
parent 1135 00eb43688a57
parent 1112 3cfc208e385b
child 1477 b056a49c16dc
equal deleted inserted replaced
1246:76b3cd5d4f31 1263:01152fffd593
    60         self.req.add_js('cubicweb.lazy.js')
    60         self.req.add_js('cubicweb.lazy.js')
    61         self.req.html_headers.add_onload("trigger_load('%s');" % vid)
    61         self.req.html_headers.add_onload("trigger_load('%s');" % vid)
    62 
    62 
    63 
    63 
    64 class TabsMixin(LazyViewMixin):
    64 class TabsMixin(LazyViewMixin):
       
    65     """a tab mixin
       
    66     """
    65 
    67 
    66     @property
    68     @property
    67     def cookie_name(self):
    69     def cookie_name(self):
    68         return str('%s_active_tab' % self.config.appid)
    70         return str('%s_active_tab' % self.config.appid)
    69 
    71 
    93         self.req.add_css('ui.tabs.css')
    95         self.req.add_css('ui.tabs.css')
    94         self.req.add_js(('ui.core.js', 'ui.tabs.js',
    96         self.req.add_js(('ui.core.js', 'ui.tabs.js',
    95                          'cubicweb.ajax.js', 'cubicweb.tabs.js', 'cubicweb.lazy.js'))
    97                          'cubicweb.ajax.js', 'cubicweb.tabs.js', 'cubicweb.lazy.js'))
    96         # tabbed views do no support concatenation
    98         # tabbed views do no support concatenation
    97         # hence we delegate to the default tab
    99         # hence we delegate to the default tab
    98         if self.req.form.get('vid') == 'primary':
   100         form = self.req.form
    99             entity.view(default)
   101         if form.get('vid') == 'primary':
       
   102             entity.view(default, w=self.w)
       
   103             return
       
   104         rql = form.get('rql')
       
   105         if rql:
       
   106             self.req.execute(rql).get_entity(0,0).view(default, w=self.w)
   100             return
   107             return
   101         # prune tabs : not all are to be shown
   108         # prune tabs : not all are to be shown
   102         tabs = self.prune_tabs(tabs)
   109         tabs = self.prune_tabs(tabs)
   103         # select a tab
   110         # select a tab
   104         active_tab = self.active_tab(tabs, default)
   111         active_tab = self.active_tab(tabs, default)