web/facet.py
changeset 949 1fba39d6ee70
parent 536 781cd9fccbaa
child 985 6a25c58a1c23
equal deleted inserted replaced
948:c95ce9b38168 949:1fba39d6ee70
   505         self.items.append(item)
   505         self.items.append(item)
   506 
   506 
   507     def _render(self):
   507     def _render(self):
   508         title = html_escape(self.facet.title)
   508         title = html_escape(self.facet.title)
   509         facetid = html_escape(self.facet.id)
   509         facetid = html_escape(self.facet.id)
   510         if len(self.items) > 6:
   510         self.w(u'<div id="%s" class="facet">\n' % facetid)
   511             self.w(u'<div id="%s" class="facet overflowed">\n' % facetid)
       
   512         else:
       
   513             self.w(u'<div id="%s" class="facet">\n' % facetid)
       
   514         self.w(u'<div class="facetTitle" cubicweb:facetName="%s">%s</div>\n' %
   511         self.w(u'<div class="facetTitle" cubicweb:facetName="%s">%s</div>\n' %
   515                (html_escape(facetid), title))
   512                (html_escape(facetid), title))
   516         if self.facet.support_and():
   513         if self.facet.support_and():
   517             _ = self.facet.req._
   514             _ = self.facet.req._
   518             self.w(u'''<select name="%s" class="radio facetOperator" title="%s">
   515             self.w(u'''<select name="%s" class="radio facetOperator" title="%s">
   521 </select>''' % (facetid + '_andor', _('and/or between different values'),
   518 </select>''' % (facetid + '_andor', _('and/or between different values'),
   522                 _('OR'), _('AND')))
   519                 _('OR'), _('AND')))
   523         cssclass = ''
   520         cssclass = ''
   524         if not self.facet.start_unfolded:
   521         if not self.facet.start_unfolded:
   525             cssclass += ' hidden'
   522             cssclass += ' hidden'
       
   523         if len(self.items) > 6:
       
   524             cssclass +=' overflowed'
   526         self.w(u'<div class="facetBody%s">\n' % cssclass)
   525         self.w(u'<div class="facetBody%s">\n' % cssclass)
   527         for item in self.items:
   526         for item in self.items:
   528             item.render(self.w)
   527             item.render(self.w)
   529         self.w(u'</div>\n')
   528         self.w(u'</div>\n')
   530         self.w(u'</div>\n')
   529         self.w(u'</div>\n')