documentcloud/visualsearch — pull request #50 by masklinn (2012-03-13 09:59:58+00:00)
Title: Pluggable SearchFacet views

Currently, VisualSearch will always instantiate a `VS.ui.SearchFacet` when rendering a facet model.

On a project I'm working on, I need some facets (inserted programmatically, see pull request 49) to have slightly special renderings or behaviors.

To that end, I simply added a `make_facet` callback option which defaults to `VS.ui.SearchFacet` and should return some sort of `VS.ui.SearchFacet`-like backbone view. Because JS constructors will use an explicitly returned value if any, `make_facet` can be a simple function as long as all code paths return a view instance.