[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

@ -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);