diff --git a/src/main/webapp/scripts/facets/list-facet.js b/src/main/webapp/scripts/facets/list-facet.js index eb0d5641e..6ef38d153 100644 --- a/src/main/webapp/scripts/facets/list-facet.js +++ b/src/main/webapp/scripts/facets/list-facet.js @@ -20,6 +20,12 @@ ListFacet.reconstruct = function(div, uiState) { return new ListFacet(div, uiState.c, uiState.o, uiState.s); }; +ListFacet.prototype.reset = function() { + this._selection = []; + this._blankChoice = null; + this._errorChoice = null; +}; + ListFacet.prototype.getUIState = function() { var json = { c: this.getJSON(), diff --git a/src/main/webapp/scripts/facets/range-facet.js b/src/main/webapp/scripts/facets/range-facet.js index aa98dde1c..aafb59a1a 100644 --- a/src/main/webapp/scripts/facets/range-facet.js +++ b/src/main/webapp/scripts/facets/range-facet.js @@ -20,23 +20,28 @@ function RangeFacet(div, config, options) { this._initializedUI = false; } -RangeFacet.prototype._setDefaults = function() { +RangeFacet.prototype.reset = function() { switch (this._config.mode) { case "min": this._from = this._config.min; + this._sliderDiv.slider("value", this._from); break; case "max": this._to = this._config.max; + this._sliderDiv.slider("value", this._to); break; default: this._from = this._config.min; this._to = this._config.max; + this._sliderDiv.slider("values", 0, this._from); + this._sliderDiv.slider("values", 1, this._to); } - this._selectNumeric = true; this._selectNonNumeric = true; this._selectBlank = true; this._selectError = true; + + this._setRangeIndicators(); }; RangeFacet.reconstruct = function(div, uiState) { @@ -104,27 +109,7 @@ RangeFacet.prototype._initializeUI = function() { $('').text(this._config.name).appendTo(headerDiv); var resetButton = $('').addClass("facet-choice-link").text("reset").click(function() { - switch (self._config.mode) { - case "min": - self._from = self._config.min; - self._sliderDiv.slider("value", self._from); - break; - case "max": - self._to = self._config.max; - self._sliderDiv.slider("value", self._to); - break; - default: - self._from = self._config.min; - self._to = self._config.max; - self._sliderDiv.slider("values", 0, self._from); - self._sliderDiv.slider("values", 1, self._to); - } - self._selectNumeric = true; - self._selectNonNumeric = true; - self._selectBlank = true; - self._selectError = true; - - self._setRangeIndicators(); + self.reset(); self._updateRest(); }).prependTo(headerDiv); @@ -355,11 +340,6 @@ RangeFacet.prototype.render = function() { this._renderOtherChoices(); }; -RangeFacet.prototype._reset = function() { - this._setDefaults(); - this._updateRest(); -}; - RangeFacet.prototype._remove = function() { ui.browsingEngine.removeFacet(this); diff --git a/src/main/webapp/scripts/facets/text-search-facet.js b/src/main/webapp/scripts/facets/text-search-facet.js index 36bdcb9d2..94dc82123 100644 --- a/src/main/webapp/scripts/facets/text-search-facet.js +++ b/src/main/webapp/scripts/facets/text-search-facet.js @@ -13,6 +13,11 @@ TextSearchFacet.reconstruct = function(div, uiState) { return new TextSearchFacet(div, uiState.c, uiState.o); }; +TextSearchFacet.prototype.reset = function() { + this._query = null; + this._div.find(".input-container input").each(function() { this.value = ""; }); +}; + TextSearchFacet.prototype.getUIState = function() { var json = { c: this.getJSON(), diff --git a/src/main/webapp/scripts/project/browsing-engine.js b/src/main/webapp/scripts/project/browsing-engine.js index c8830341e..b70097623 100644 --- a/src/main/webapp/scripts/project/browsing-engine.js +++ b/src/main/webapp/scripts/project/browsing-engine.js @@ -44,10 +44,16 @@ BrowsingEngine.prototype._initializeUI = function() { var self = this; this._div.html( - '
refreshing facets ...
' + - '
' + - ' show dependent rows • ' + - 'refresh
' + + '
' + + '
refreshing facets ...
' + + '
' + + '

' + + 'refresh • ' + + 'reset • ' + + 'remove all facets' + + '

' + + '

show dependent rows

' + + '
' + '
' + '' ); @@ -65,6 +71,8 @@ BrowsingEngine.prototype._initializeUI = function() { }); this._elmts.refreshLink.click(function() { self.update(); }); + this._elmts.resetLink.click(function() { self.reset(); }); + this._elmts.removeLink.click(function() { self.remove(); }); }; BrowsingEngine.prototype._updateFacetOrder = function() { @@ -170,3 +178,28 @@ BrowsingEngine.prototype.update = function(onDone) { "json" ); }; + +BrowsingEngine.prototype.reset = function() { + for (var i = 0; i < this._facets.length; i++) { + this._facets[i].facet.reset(); + } + + Gridworks.update({ engineChanged: true }); +}; + +BrowsingEngine.prototype.remove = function() { + var oldFacets = this._facets; + + this._facets = []; + + for (var i = 0; i < oldFacets.length; i++) { + oldFacets[i].elmt.hide(); + } + window.setTimeout(function() { + for (var i = 0; i < oldFacets.length; i++) { + oldFacets[i].elmt.remove(); + } + }, 300); + + Gridworks.update({ engineChanged: true }); +}; diff --git a/src/main/webapp/styles/common.css b/src/main/webapp/styles/common.css index 1d4f3a521..c4f86a2ea 100644 --- a/src/main/webapp/styles/common.css +++ b/src/main/webapp/styles/common.css @@ -74,6 +74,9 @@ div.grid-layout.layout-looser > table { input[type="checkbox"], input[type="radio"] { vertical-align: baseline; } +input.inline { + vertical-align: middle; +} div.input-container { padding: 3px; diff --git a/src/main/webapp/styles/project/browsing.css b/src/main/webapp/styles/project/browsing.css index 460051731..0990cf63b 100644 --- a/src/main/webapp/styles/project/browsing.css +++ b/src/main/webapp/styles/project/browsing.css @@ -1,14 +1,15 @@ -.browsing-panel-indicator { - display: none; +.browsing-panel-header { margin: 0 1em; margin-top: 50px; + height: 5em; text-align: center; } + +.browsing-panel-indicator { + display: none; +} .browsing-panel-controls { display: none; - margin: 0 1em; - margin-top: 50px; - text-align: center; } ul.facets-container {