diff --git a/platform/commonUI/browse/res/templates/browse.html b/platform/commonUI/browse/res/templates/browse.html index 0f8291ffde..85aeb38ca2 100644 --- a/platform/commonUI/browse/res/templates/browse.html +++ b/platform/commonUI/browse/res/templates/browse.html @@ -29,12 +29,11 @@
- + - +
diff --git a/platform/search/bundle.json b/platform/search/bundle.json index 7599c40db3..7ea1536556 100644 --- a/platform/search/bundle.json +++ b/platform/search/bundle.json @@ -26,7 +26,7 @@ "depends": [ "$scope", "$document" ] } ], - "templates": [ + "representations": [ { "key": "search", "templateUrl": "templates/search.html" @@ -34,9 +34,7 @@ { "key": "search-menu", "templateUrl": "templates/search-menu.html" - } - ], - "representations": [ + }, { "key": "search-item", "templateUrl": "templates/search-item.html" diff --git a/platform/search/res/templates/search.html b/platform/search/res/templates/search.html index 52bdd3af1e..5313cd12ed 100644 --- a/platform/search/res/templates/search.html +++ b/platform/search/res/templates/search.html @@ -58,12 +58,12 @@ - - +
diff --git a/platform/search/src/controllers/SearchController.js b/platform/search/src/controllers/SearchController.js index 792492158e..10cf056b4f 100644 --- a/platform/search/src/controllers/SearchController.js +++ b/platform/search/src/controllers/SearchController.js @@ -30,8 +30,8 @@ define(function () { var INITIAL_LOAD_NUMBER = 20, LOAD_INCREMENT = 20; - function SearchController($scope, searchService, types) { - // numResults is the starting amount of results to load. Will get increased. + function SearchController($scope, searchService) { + // numResults is the amount of results to display. Will get increased. // fullResults holds the most recent complete searchService response object var numResults = INITIAL_LOAD_NUMBER, fullResults = {hits: []}; @@ -46,7 +46,7 @@ define(function () { // ngModel.filter, the function filter defined below // ngModel.types, an array of type objects // ngModel.checked, a dictionary of which type filter options are checked - // ngModel.checkAll, a boolean of whether all of the types in ngModel.checked are checked + // ngModel.checkAll, a boolean of whether to search all types // ngModel.filtersString, a string list of what filters on the results are active $scope.results = []; $scope.loading = false; @@ -70,7 +70,7 @@ define(function () { } else { while (newResults.length < numResults && i < hits.length) { // If this is of an acceptable type, add it to the list - if ($scope.ngModel.checked[hits[i].object.getModel().type] === true) { + if ($scope.ngModel.checked[hits[i].object.getModel().type]) { newResults.push(fullResults.hits[i]); } i += 1; @@ -88,14 +88,12 @@ define(function () { function search(maxResults) { var inputText = $scope.ngModel.input; - // We are starting to load. if (inputText !== '' && inputText !== undefined) { + // We are starting to load. $scope.loading = true; - } - - // Update whether the file tree should be displayed - // Hide tree only when starting search - if (inputText !== '' && inputText !== undefined) { + + // Update whether the file tree should be displayed + // Hide tree only when starting search $scope.ngModel.search = true; } @@ -106,8 +104,9 @@ define(function () { // Send the query searchService.query(inputText, maxResults).then(function (result) { + // Store all the results before splicing off the front, so that + // we can load more to display later. fullResults = result; - //$scope.results = result.hits.slice(0, numResults); $scope.results = filter(result.hits); // Update whether the file tree should be displayed diff --git a/platform/search/src/controllers/SearchMenuController.js b/platform/search/src/controllers/SearchMenuController.js index c1ef7d66d8..e0d8c342e5 100644 --- a/platform/search/src/controllers/SearchMenuController.js +++ b/platform/search/src/controllers/SearchMenuController.js @@ -40,7 +40,7 @@ define(function () { $scope.ngModel.checkAll = true; $scope.ngModel.filtersString = ''; - // On initialization, fill the scope's types with type keys + // On initialization, fill the model's types with type keys types.forEach(function (type) { // We only want some types, the ones that are probably human readable // Manually remove 'root', but not 'unknown' @@ -67,7 +67,7 @@ define(function () { // Update the current filters string $scope.ngModel.filtersString = ''; - if ($scope.ngModel.checkAll !== true) { + if (!$scope.ngModel.checkAll) { for (i = 0; i < $scope.ngModel.types.length; i += 1) { // If the type key corresponds to a checked option... if ($scope.ngModel.checked[$scope.ngModel.types[i].key]) { @@ -94,30 +94,21 @@ define(function () { function checkAll() { var type; - // If model's checkAll has just been checked, reset everything else - // to default view, and behave as if there are no filters (default) - if ($scope.ngModel.checkAll) { - // Uncheck everything else - for (type in $scope.ngModel.checked) { - $scope.ngModel.checked[type] = false; - } - - // Reset filter display - $scope.ngModel.filtersString = ''; - - // Re-filter results - $scope.ngModel.filter(); - } else { - // If model's checkAll has just been UNchecked, set filters to none - - for (type in $scope.ngModel.checked) { - $scope.ngModel.checked[type] = false; - } - $scope.ngModel.filtersString = 'NONE'; - - // Re-filter results - $scope.ngModel.filter(); + // Reset all the other options to original/default position + for (type in $scope.ngModel.checked) { + $scope.ngModel.checked[type] = false; } + + // Change the filters string depending on checkAll status + if ($scope.ngModel.checkAll) { + // This setting will make the filters display hidden + $scope.ngModel.filtersString = ''; + } else { + $scope.ngModel.filtersString = 'NONE'; + } + + // Re-filter results + $scope.ngModel.filter(); } return {