Skip to content

Commit

Permalink
Merge ab8680b into 6406373
Browse files Browse the repository at this point in the history
  • Loading branch information
ger-benjamin committed Jan 25, 2016
2 parents 6406373 + ab8680b commit 566b224
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion contribs/gmf/src/directives/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ gmfModule.directive('gmfSearch', gmf.searchDirective);
* @constructor
* @param {angular.Scope} $scope The directive's scope.
* @param {angular.$compile} $compile Angular compile service.
* @param {angular.$timeout} $timeout Angular timeout service.
* @param {angularGettext.Catalog} gettextCatalog Gettext catalog.
* @param {ngeo.CreateGeoJSONBloodhound} ngeoCreateGeoJSONBloodhound The ngeo
* create GeoJSON Bloodhound service.
Expand All @@ -101,7 +102,7 @@ gmfModule.directive('gmfSearch', gmf.searchDirective);
* @ngdoc controller
* @ngname GmfSearchController
*/
gmf.SearchController = function($scope, $compile, gettextCatalog,
gmf.SearchController = function($scope, $compile, $timeout, gettextCatalog,
ngeoCreateGeoJSONBloodhound, ngeoFeatureOverlayMgr) {

/**
Expand All @@ -116,6 +117,12 @@ gmf.SearchController = function($scope, $compile, gettextCatalog,
*/
this.compile_ = $compile;

/**
* @type {angular.$timeout}
* @private
*/
this.timeout_ = $timeout;

/**
* @type {angularGettext.Catalog}
* @private
Expand Down Expand Up @@ -372,6 +379,19 @@ gmf.SearchController.prototype.clear = function() {
};


/**
* @export
*/
gmf.SearchController.prototype.blur = function() {
var typeahead = $('.twitter-typeahead');
var inputs = typeahead.children('input');
// Blur as soon as possible in digest loops
this.timeout_(function() {
$(inputs[1]).blur();
});
};


/**
* @param {jQuery.Event} event Event.
* @param {ol.Feature} feature Feature.
Expand All @@ -392,6 +412,7 @@ gmf.SearchController.select_ = function(event, feature, dataset) {
if (!this.clearButton) {
this.clear();
}
this.blur();
};


Expand Down

0 comments on commit 566b224

Please sign in to comment.