91 except NoSelectableObject: |
91 except NoSelectableObject: |
92 continue |
92 continue |
93 return selected_tabs |
93 return selected_tabs |
94 |
94 |
95 def render_tabs(self, tabs, default, entity=None): |
95 def render_tabs(self, tabs, default, entity=None): |
96 # tabbed views do no support concatenation |
96 # delegate to the default tab if there is more than one entity |
97 # hence we delegate to the default tab if there is more than on entity |
97 # in the result set (tabs are pretty useless there) |
98 # in the result set |
|
99 if entity and len(self.rset) > 1: |
98 if entity and len(self.rset) > 1: |
100 entity.view(default, w=self.w) |
99 entity.view(default, w=self.w) |
101 return |
100 return |
102 # XXX (syt) fix below add been introduced at some point to fix something |
|
103 # (http://intranet.logilab.fr/jpl/ticket/32174 ?) but this is not a clean |
|
104 # way. We must not consider form['rql'] here since it introduces some |
|
105 # other failures on non rql queries (plain text, shortcuts,... handled by |
|
106 # magicsearch) which has a single result whose primary view is using tabs |
|
107 # (https://www.logilab.net/cwo/ticket/342789) |
|
108 #rql = self.req.form.get('rql') |
|
109 #if rql: |
|
110 # self.req.execute(rql).get_entity(0,0).view(default, w=self.w) |
|
111 # return |
|
112 self.req.add_css('ui.tabs.css') |
101 self.req.add_css('ui.tabs.css') |
113 self.req.add_js(('ui.core.js', 'ui.tabs.js', |
102 self.req.add_js(('ui.core.js', 'ui.tabs.js', |
114 'cubicweb.ajax.js', 'cubicweb.tabs.js', 'cubicweb.lazy.js')) |
103 'cubicweb.ajax.js', 'cubicweb.tabs.js', 'cubicweb.lazy.js')) |
115 # prune tabs : not all are to be shown |
104 # prune tabs : not all are to be shown |
116 tabs = self.prune_tabs(tabs) |
105 tabs = self.prune_tabs(tabs) |