Add button to hide search on mobile devices

pull/54/merge
Candid Dauth 2016-12-21 21:34:50 +01:00
rodzic e229804cc1
commit 15f5cd80aa
4 zmienionych plików z 21 dodań i 6 usunięć

Wyświetl plik

@ -154,7 +154,7 @@
scope.clear();
};
var el = $($templateCache.get("map/search/search-route.html")).insertAfter(map.map.getContainer());
var el = $($templateCache.get("map/search/search-route.html")).appendTo(searchUi._el);
$compile(el)(scope);
scope.$evalAsync(); // $compile only replaces variables on next digest

Wyświetl plik

@ -1,7 +1,13 @@
.fm-search-mobile-toggle {
position: absolute;
top: 26px;
left: 60px;
}
.fm-search {
position: absolute;
top: 10px;
left: 60px;
left: 52px;
box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 5px rgba(0,0,0,.075);
opacity: .7;
@ -11,6 +17,12 @@
max-width: 350px;
}
@media (max-width: 767px) {
.fm-search {
left: 100px;
}
}
.fm-search:hover,.fm-search.fm-hasFocus {
opacity: 1;
}

Wyświetl plik

@ -1,4 +1,5 @@
<div class="fm-search fm-search-search panel panel-default" ng-class="{'fm-hasResults': !!searchResults}">
<button type="button" class="btn btn-default visible-xs-block mobile-menu-button fm-search-mobile-toggle" ng-click="showXs = !showXs" uib-tooltip="{{showXs ? 'Hide search' : 'Show search'}}" tooltip-placement="right"><span class="glyphicon glyphicon-search"></span></button>
<div class="fm-search fm-search-search panel panel-default" ng-class="{'fm-hasResults': !!searchResults, 'hidden-xs': !showXs}">
<div class="panel-body">
<form ng-submit="search()">
<div class="form-group">

Wyświetl plik

@ -366,14 +366,16 @@
}
var searchUi = {
_el: el.find(".fm-search"),
show: function() {
el.show();
searchUi._el.show();
map.mapEvents.$emit("searchchange");
},
hide: function() {
reset();
el.hide();
searchUi._el.hide();
map.mapEvents.$emit("searchchange");
},
@ -403,7 +405,7 @@
},
getCurrentSearchForHash: function() {
if(el.is(":visible")) {
if(searchUi._el.is(":visible")) {
if(((scope.searchResults && scope.searchResults.length == 1) || !scope.showAll) && scope.activeResult && scope.activeResult.id)
return scope.activeResult.id;
else if(scope.submittedSearchString)