# HG changeset patch # User Sylvain Thénault # Date 1492776106 -7200 # Node ID ef46695adb684f399450dadcf527bd3ea804269a # Parent fea018b2e056c2d1b759c04889dbbccb59796027 [facets] Fix disappearance of navtop component on facet filtering which is because facets are replacing the whole #pageContent div, while this one contains other stuff than the view: * a type selector component that should be dropped for a while, * a computed title, * the page navigation. Then the view content itself is in a #contentmain div. The thing is that the navigation should be rebuilded on filtering (this is not the case for other bullets in the list above). This is currently handled specifically in the ajaxcontroller (except for the type selector which will disappear... who said it should be dropped at once?). So to fix this we: * put the page navigation into the "contentmain" div * don't replace anymore "pageContent" but "contentmain" After that we can even remove from the ajax controller the code that reimplements title handling similarly to the main template. Notice the part that changes the main template has to be ported to squareui. Closes #17074195 diff -r fea018b2e056 -r ef46695adb68 cubicweb/web/component.py --- a/cubicweb/web/component.py Mon Jun 19 18:15:28 2017 +0200 +++ b/cubicweb/web/component.py Fri Apr 21 14:01:46 2017 +0200 @@ -126,7 +126,7 @@ return url def ajax_page_url(self, **params): - divid = params.setdefault('divid', 'pageContent') + divid = params.setdefault('divid', 'contentmain') params['rql'] = self.cw_rset.printable_rql() return js_href("$(%s).loadxhtml(AJAX_PREFIX_URL, %s, 'get', 'swap')" % ( json_dumps('#'+divid), js.ajaxFuncArgs('view', params))) diff -r fea018b2e056 -r ef46695adb68 cubicweb/web/views/ajaxcontroller.py --- a/cubicweb/web/views/ajaxcontroller.py Mon Jun 19 18:15:28 2017 +0200 +++ b/cubicweb/web/views/ajaxcontroller.py Fri Apr 21 14:01:46 2017 +0200 @@ -241,29 +241,25 @@ stream = UStringIO() kwargs['w'] = stream.write assert not paginate - if divid == 'pageContent': + if divid == 'contentmain': # ensure divid isn't reused by the view (e.g. table view) del self._cw.form['divid'] - # mimick main template behaviour - stream.write(u'
') - vtitle = self._cw.form.get('vtitle') - if vtitle: - stream.write(u'

%s

\n' % vtitle) paginate = True + if divid == 'contentmain': + stream.write(u'
') nav_html = UStringIO() if paginate and not view.handle_pagination: view.paginate(w=nav_html.write) stream.write(nav_html.getvalue()) - if divid == 'pageContent': - stream.write(u'
') view.render(**kwargs) + stream.write(nav_html.getvalue()) + if divid == 'contentmain': + stream.write(u'
') extresources = self._cw.html_headers.getvalue(skiphead=True) if extresources: stream.write(u'
\n') # XXX use a widget? stream.write(extresources) stream.write(u'
\n') - if divid == 'pageContent': - stream.write(u'
%s
' % nav_html.getvalue()) return stream.getvalue() diff -r fea018b2e056 -r ef46695adb68 cubicweb/web/views/basetemplates.py --- a/cubicweb/web/views/basetemplates.py Mon Jun 19 18:15:28 2017 +0200 +++ b/cubicweb/web/views/basetemplates.py Fri Apr 21 14:01:46 2017 +0200 @@ -158,14 +158,14 @@ 'etypenavigation', self._cw, rset=self.cw_rset) if etypefilter and etypefilter.cw_propval('visible'): etypefilter.render(w=w) + w(u'
\n') nav_html = UStringIO() if view and not view.handle_pagination: view.paginate(w=nav_html.write) w(nav_html.getvalue()) - w(u'
\n') view.render(w=w) + w(nav_html.getvalue()) w(u'
\n') # close id=contentmain - w(nav_html.getvalue()) w(u'
\n') # closes id=pageContent self.template_footer(view) diff -r fea018b2e056 -r ef46695adb68 cubicweb/web/views/facets.py --- a/cubicweb/web/views/facets.py Mon Jun 19 18:15:28 2017 +0200 +++ b/cubicweb/web/views/facets.py Fri Apr 21 14:01:46 2017 +0200 @@ -246,7 +246,7 @@ rset, vid, divid, paginate = context else: rset = self.cw_rset - vid, divid = None, 'pageContent' + vid, divid = None, 'contentmain' paginate = view and view.paginable return rset, vid, divid, paginate