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