[facets] Honor 'start_unfolded' facet attribute (closes #4502799)
authorRémi Cardona <remi.cardona@logilab.fr>
Mon, 20 Oct 2014 12:50:04 +0200
changeset 10030 e19c322ede4b
parent 10029 832a2a0b7bd2
child 10031 bea3f6595fb4
[facets] Honor 'start_unfolded' facet attribute (closes #4502799)
web/facet.py
--- a/web/facet.py	Mon Oct 20 12:23:13 2014 +0200
+++ b/web/facet.py	Mon Oct 20 12:50:04 2014 +0200
@@ -1620,7 +1620,10 @@
             cssclass += ' hideFacetBody'
         w(u'<div class="%s" cubicweb:facetName="%s">%s</div>\n' %
                (cssclass, xml_escape(self.facet.__regid__), title))
-        w(u'<div class="facetBody">\n')
+        cssclass = 'facetBody'
+        if not self.facet.start_unfolded:
+            cssclass += ' hidden'
+        w(u'<div class="%s">\n' % cssclass)
         w(u'<input name="%s" type="text" value="%s" />\n' % (
                 xml_escape(self.facet.__regid__), self.value or u''))
         w(u'</div>\n')