[boxes] do not write HTML markup for aside columns if no box content available (closes #3643330)

authorKatia Saurfelt <katia.saurfelt@logilab.fr>
changeset45b3eb604765
branchdefault
phasepublic
hiddenno
parent revision#0de68c23d372 [HTML] remove useless `div`
child revision#73b591092ca6 [HTMLContentFooter] remove useless `div.row`
files modified by this revision
views/basetemplates.py
# HG changeset patch
# User Katia Saurfelt <katia.saurfelt@logilab.fr>
# Date 1394640593 -3600
# Wed Mar 12 17:09:53 2014 +0100
# Node ID 45b3eb604765f7963941c1ad2fdeba0af6dcc839
# Parent 0de68c23d372cd31a92398b5639bf519974e6be4
[boxes] do not write HTML markup for aside columns if no box content available (closes #3643330)

diff --git a/views/basetemplates.py b/views/basetemplates.py
@@ -114,16 +114,19 @@
1      return self.w(u'<div class="alert alert-info">%s</div>' % msg)
2 
3  @monkeypatch(basetemplates.TheMainTemplate)
4  def nav_column(self, view, boxes, context):
5      if boxes:
6 -        getlayout = self._cw.vreg['components'].select
7 -        self.w(u'<div id="aside-main-%s" class="col-md-3">\n' %
8 -               context)
9 +        html = []
10          for box in boxes:
11 -            box.render(w=self.w, view=view)
12 -        self.w(u'</div>\n')
13 +            box.render(w=html.append, view=view)
14 +        if html:
15 +            # only display aside columns if html availble
16 +            self.w(u'<div id="aside-main-%s" class="col-md-3">\n' %
17 +                   context)
18 +            self.w(u'\n'.join(html))
19 +            self.w(u'</div>\n')
20      return len(boxes)
21 
22  @monkeypatch(basetemplates.TheMainTemplate)
23  def content_column(self, view, content_cols):
24      w = self.w