[Search] Filter display

Added display below the search bar of what
search filters are currently active.
Not yet correctly aligned wrt search
results list.
This commit is contained in:
slhale
2015-08-13 15:11:17 -07:00
parent 74cf4d73d5
commit 5726dd0e0c
4 changed files with 98 additions and 45 deletions

View File

@@ -61,7 +61,8 @@
<ul>
<!-- First element is special - it's a reset option -->
<li class="search-menu-item special">
<li class="search-menu-item special"
title="Select all filters.">
<label class="checkbox custom search-menu-checkbox">
<input type="checkbox"
@@ -99,13 +100,21 @@
</li>
</ul>
</div>
</div>
</div>
<!-- Active filter display -->
<div class="active-filter-display"
ng-if="filtersString !== ''">
Filtered by: {{ filtersString }}
<a class="ui-symbol clear-filters-icon"
ng-click="ngModel.checkAll = true; controller.checkAll(); controller.updateOptions()">
x
</a>
</div>
<!-- This div exists to determine scroll bar location -->
<div class="search-scroll abs">

View File

@@ -41,6 +41,7 @@ define(function () {
// $scope.ngModel.input, $scope.ngModel.search, $scope.ngModel.checked
$scope.types = [];
$scope.ngModel.checked = {};
$scope.filtersString = "";
function filter(hits) {
var newResults = [],
@@ -185,13 +186,23 @@ define(function () {
updateOptions: function () {
var type;
// Update all-checked status
// Update all-checked status and the filters string
$scope.ngModel.checkAll = true;
$scope.filtersString = '';
for (type in $scope.ngModel.checked) {
if (!$scope.ngModel.checked[type]) {
$scope.ngModel.checkAll = false;
} else {
if ($scope.filtersString === '') {
$scope.filtersString += type;
} else {
$scope.filtersString += ', ' + type;
}
}
}
if ($scope.ngModel.checkAll === true) {
$scope.filtersString = '';
}
// Re-filter results
$scope.results = filter(fullResults.hits);