From 05c43db6fe85b8938a25bee5c4b3e9fdc1ddecad Mon Sep 17 00:00:00 2001 From: shale Date: Fri, 24 Jul 2015 13:04:42 -0700 Subject: [PATCH] [Search] Search input using the model Made the search bar text input go to ngModel.input, rather than getting the text manually from the DOM element. Additionally, removed the search service from the search controller's scope. --- platform/features/search/bundle.json | 2 +- .../features/search/res/templates/search.html | 25 ++++++++++++++----- .../search/res/templates/searchbar.html | 12 +++++++-- .../src/controllers/SearchController.js | 10 +++----- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/platform/features/search/bundle.json b/platform/features/search/bundle.json index 0b54821d14..7190537305 100644 --- a/platform/features/search/bundle.json +++ b/platform/features/search/bundle.json @@ -21,7 +21,7 @@ ], "controls": [ { - "key": "searchbar", + "key": "searchbar-control", "templateUrl": "templates/searchbar.html" } ], diff --git a/platform/features/search/res/templates/search.html b/platform/features/search/res/templates/search.html index f1d5ca245c..d24b2d5d80 100644 --- a/platform/features/search/res/templates/search.html +++ b/platform/features/search/res/templates/search.html @@ -24,13 +24,26 @@
- + ng-model="ngModel.input" + ng-keyup="controller.search()" /> +
@@ -39,7 +52,7 @@
diff --git a/platform/features/search/res/templates/searchbar.html b/platform/features/search/res/templates/searchbar.html index 42d9e9dcc4..1b9508e45a 100644 --- a/platform/features/search/res/templates/searchbar.html +++ b/platform/features/search/res/templates/searchbar.html @@ -20,7 +20,15 @@ at runtime from the About dialog for additional information. --> - \ No newline at end of file + value="" /--> + + + + + + + \ No newline at end of file diff --git a/platform/features/search/src/controllers/SearchController.js b/platform/features/search/src/controllers/SearchController.js index 1d6764d91d..2aa1c7bf86 100644 --- a/platform/features/search/src/controllers/SearchController.js +++ b/platform/features/search/src/controllers/SearchController.js @@ -40,7 +40,7 @@ define(function () { // This allows us to directly access the search aggregator's members. // Most important is latestResults, which is continuously updated. This // means that this controller does not have to poll for results any more. - $scope.searchService = searchService; + //$scope.searchService = searchService; // TODO: Modify search aggregator to have a search result array which // is of a size that can be chosen and modified by this controller. @@ -70,10 +70,10 @@ define(function () { waitForLatest(); } - function search(inputID) { + function search() { var date = new Date(), timestamp = date.getTime(), - inputText = document.getElementById(inputID).value; + inputText = $scope.ngModel.input;//document.getElementById(inputID).value; // Update whether the file tree should be displayed if (inputText === '') { @@ -94,9 +94,7 @@ define(function () { return { /** * Search the filetree. - * - * @param inputID The name of the ID property of the html text - * input where this funcion should find the search term. + * Assumes that there will be search text in ngModel.input */ search: search,