From ebe4bdc3233b1e2ae8d5ae71acebdbffb809cdf3 Mon Sep 17 00:00:00 2001 From: Lucas Silvestre Date: Tue, 28 Aug 2018 18:07:45 +0200 Subject: [PATCH] Make search icon perform the search --- src/components/search/search.directive.js | 21 ++++++++++++++------- src/components/search/search.html | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/search/search.directive.js b/src/components/search/search.directive.js index b61cc3938..f95d7326d 100644 --- a/src/components/search/search.directive.js +++ b/src/components/search/search.directive.js @@ -39,15 +39,21 @@ AppSearch.directive('search', ($stateParams, $location, $timeout, Global, $http) }, 200); }; - this.expandInput = () => { - this.activeForm = !this.activeForm; - $timeout(() => { - document.getElementById('search').focus(); - }, 500); + this.onSearchIconClick = () => { + if (!this.mobileView) { + this.search(); + } else { + this.activeForm = !this.activeForm; + $timeout(() => { + document.getElementById('search').focus(); + }, 500); + } }; this.hideSuggestion = () => { - _resetSearch(); + if (!this.loading) { + _resetSearch(); + } }; this.search = () => { @@ -75,7 +81,8 @@ AppSearch.directive('search', ($stateParams, $location, $timeout, Global, $http) }; }; - const SearchLink = function () { + const SearchLink = function (scope) { + scope.activeForm = !scope.mobileView; }; return { diff --git a/src/components/search/search.html b/src/components/search/search.html index a999ebc79..e3ca0b5a1 100644 --- a/src/components/search/search.html +++ b/src/components/search/search.html @@ -19,7 +19,7 @@
- +