Skip to content
Snippets Groups Projects
Commit ed6ef354 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch...

Merge branch '13-manchmal-wird-das-eingabefeld-geloscht-wenn-kein-ergebnis-gefunden-werden-kann' into 'master'

Resolve "Manchmal wird das Eingabefeld gelöscht, wenn kein Ergebnis gefunden werden kann"

Closes #13

See merge request open-source/MetaGerMaps!4
parents e931ac98 9178265e
No related branches found
No related tags found
1 merge request!4Resolve "Manchmal wird das Eingabefeld gelöscht, wenn kein Ergebnis gefunden werden kann"
...@@ -111,9 +111,9 @@ SearchModule.prototype.startSearch = function(moveMap){ ...@@ -111,9 +111,9 @@ SearchModule.prototype.startSearch = function(moveMap){
// Hide every History Item Container // Hide every History Item Container
$("#search-addon .results .history-container .item").hide(); $("#search-addon .results .history-container .item").hide();
if(this.results != null && this.results != undefined){ if(this.results != undefined){
this.results.deleteSearch(); this.results.deleteSearch();
this.results = null; this.results = undefined;
} }
// Generate the Url for the Search Results // Generate the Url for the Search Results
...@@ -128,15 +128,31 @@ SearchModule.prototype.startSearch = function(moveMap){ ...@@ -128,15 +128,31 @@ SearchModule.prototype.startSearch = function(moveMap){
url: url, url: url,
dataType: 'json', dataType: 'json',
success: $.proxy(function(data){ success: $.proxy(function(data){
if(typeof moveMap == "boolean") console.log(data);
this.results = new Results(this.interactiveMap, data, this.query, moveMap, this.resultsHistory);
else
this.results = new Results(this.interactiveMap, data, this.query, undefined, this.resultsHistory);
if(data.length > 0){ if(data.length > 0){
if(typeof moveMap == "boolean")
this.results = new Results(this.interactiveMap, data, this.query, moveMap, this.resultsHistory);
else
this.results = new Results(this.interactiveMap, data, this.query, undefined, this.resultsHistory);
this.updateURL(); this.updateURL();
// This was a succesfull // This was a succesfull
this.searchHistory.addItem({query: this.query}); this.searchHistory.addItem({query: this.query});
$("#search input[name=q]").blur(); $("#search input[name=q]").blur();
}else{
// The search wasn't successfull but the input field got cleared. We need to put the last search back in
$("#search input[name=q]").val(this.query);
this.updateURL();
$("#search input[name=q]").focus();
$("#search input[name=q]").tooltip({
title: "Leider konnten keine Ergebnisse gefunden werden.",
element: $("#search input[name=q]"),
placement: "bottom"
});
$("#search input[name=q]").tooltip("show");
window.setTimeout(function(){
$("#search input[name=q]").tooltip("destroy");
}, 3000);
} }
this.unlockSearchFunctions(); this.unlockSearchFunctions();
}, this), }, this),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment