From 4cc6681055c39e140161969a99499f70b2834785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Di=20Biase?= Date: Thu, 30 Jan 2014 09:38:23 -0300 Subject: [PATCH 1/2] Add clearSearch in defaults callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Luis Di Biase --- lib/js/visualsearch.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/js/visualsearch.js b/lib/js/visualsearch.js index 42f25e5..ca30033 100644 --- a/lib/js/visualsearch.js +++ b/lib/js/visualsearch.js @@ -39,7 +39,8 @@ focus : $.noop, blur : $.noop, facetMatches : $.noop, - valueMatches : $.noop + valueMatches : $.noop, + clearSearch : $.noop, } }; this.options = _.extend({}, defaults, options); From f9f9cba4fb4adc31d63de76ddd7dfd1aa5a42f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Di=20Biase?= Date: Thu, 30 Jan 2014 09:39:03 -0300 Subject: [PATCH 2/2] Expose removedFacet as a callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Luis Di Biase --- lib/js/views/search_box.js | 6 +++++- lib/js/visualsearch.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/js/views/search_box.js b/lib/js/views/search_box.js index 88b5d53..c5506be 100644 --- a/lib/js/views/search_box.js +++ b/lib/js/views/search_box.js @@ -142,7 +142,11 @@ VS.ui.SearchBox = Backbone.View.extend({ // remaining facet is selected, but this is handled by the facet's view, // since its position is unknown by the time the collection triggers this // remove callback. - removedFacet : function (facet, query, options) {}, + removedFacet : function (facet, query, options) { + if (this.app.options.callbacks.removedFacet) { + this.app.options.callbacks.removedFacet(facet, query, options); + } + }, // Renders each facet as a searchFacet view. renderFacets : function() { diff --git a/lib/js/visualsearch.js b/lib/js/visualsearch.js index ca30033..6395d79 100644 --- a/lib/js/visualsearch.js +++ b/lib/js/visualsearch.js @@ -41,6 +41,7 @@ facetMatches : $.noop, valueMatches : $.noop, clearSearch : $.noop, + removedFacet : $.noop, } }; this.options = _.extend({}, defaults, options);