[Search] Added input ID parameter

Added a parameter to the controller's search
function so that the html side can clearly
see/choose which input ID is being used as
the search input.
This commit is contained in:
shale 2015-07-14 09:59:48 -07:00
parent c92d15ba42
commit 457193657f
2 changed files with 14 additions and 5 deletions
platform/features/search

@ -31,7 +31,7 @@
value=""/> value=""/>
<span class="button"> <span class="button">
<button type="button" <button type="button"
ng-click="controller.search()">Go</button> ng-click="controller.search('searchinput')">Go</button>
</span> </span>
</div> </div>

@ -77,8 +77,17 @@ define(function () {
} }
// Use elasticsearch's search to search through all the objects // Use elasticsearch's search to search through all the objects
function searchElastic() { function searchElastic(inputID) {
var searchTerm = document.getElementById("searchinput").value; var searchTerm;
// Get the user input
if (inputID) {
searchTerm = document.getElementById(inputID).value;
} else {
// Backward compatibility?
// TODO: May be unnecsisary
searchTerm = document.getElementById("searchinput").value;
}
// Get the data... // Get the data...
return $http({ return $http({
@ -131,8 +140,8 @@ define(function () {
return { return {
// Search the database using the user input of id "searchinput" // Search the database using the user input of id "searchinput"
search: function () { search: function (inputID) {
searchElastic().then( function (c) { searchElastic(inputID).then( function (c) {
$scope.results = c; $scope.results = c;
}); });
}, },