Add simple/structured query selector to HTML search page (#1722)

This commit is contained in:
galewis2
2020-05-07 19:29:44 -04:00
committed by GitHub
parent fc19ebb218
commit a5e3785843
4 changed files with 90 additions and 20 deletions

View File

@@ -1,11 +1,11 @@
form {
.top-bar {
width: 100%;
padding: 1em 15px;
}
form #q {
min-width: 500px;
.top-bar #q {
max-width: 500px;
}
@media (max-width: 850px) {
form #q {
@@ -147,6 +147,17 @@ footer p {
width: 100%;
}
.search-button-group {
display: inline
display: inline;
}
}
.search-button-group {
margin-top: 3px;
box-sizing: content-box;
margin-bottom: 3px;
}
label {
font-weight: normal;
}

View File

@@ -20,11 +20,27 @@ function parse_and_normalize_geojson_string(raw_string){
jQuery(document).ready(function(){
if ( !$('#search-page,#reverse-page').length ){ return; }
var is_reverse_search = !!( $('#reverse-page').length );
$('#q').focus();
$(document).ready(function() {
$("input[name='query-selector']").click(function(){
var query_val = $("input[name='query-selector']:checked").val() ;
if (query_val == "simple") {
$("div.form-group-structured").hide();
$("div.form-group-simple").show();
$('.form-group-structured').find('input:text').val('');
}
else if (query_val == "structured") {
$("div.form-group-simple").hide();
$("div.form-group-structured").show();
$('.form-group-simple').find('input:text').val('');
}
});
});
map = new L.map('map', {
attributionControl: (nominatim_map_init.tile_attribution && nominatim_map_init.tile_attribution.length),
scrollWheelZoom: true, // !L.Browser.touch,
@@ -185,7 +201,7 @@ jQuery(document).ready(function(){
circle.on('click', function(){
highlight_result(position);
});
layerGroup.addLayer(circle);
layerGroup.addLayer(circle);
}
if (result.aBoundingBox){