CubicWeb has this really nice builtin facet system to define restrictions filters really as easily as possible. We've just added two new kind of facets in CubicWeb :
Here's an example of code that defines a facet to filter musical works according to their composition date: class CompositionDateFacet(DateRangeFacet):
# 1. make sure this facet is displayed only on Track selection
__select__ = DateRangeFacet.__select__ & implements('Track')
# 2. give the facet an id (required by CubicWeb)
id = 'compdate-facet'
# 3. specify the attribute name that actually stores the date in the DB
rtype = 'composition_date'
And that's it, on each page displaying tracks, you'll be able to filter them according to their composition date with a jquery slider. All this, brought by CubicWeb (in the next 3.3 version) |


Comments
As quick update, note that CubicWeb 3.3 provides three new standard facets: RangeFacet, DateRangeFacet and HasRelationFacet.
Plone[1] is catching on to the facets movement, check out : http://www.mostscript.com/sean/2009/6/5/rethinking-folders-part-one
[1] http://www.plone.org
And http://www.mostscript.com/sean/2008/03/31/refine-your-search with some nice diagrams