]> git.openstreetmap.org Git - nominatim-ui.git/blobdiff - src/components/SearchSectionReverse.svelte
Search page: Set HTML page title for structured searches, too
[nominatim-ui.git] / src / components / SearchSectionReverse.svelte
index 2f53f39751f5376af959c550f1e994b5cfb3b05b..70174b697ed9f1ba552a582d1079ec518806cb07 100644 (file)
@@ -7,6 +7,7 @@
   export let lat = '';
   export let lon = '';
   export let zoom = '';
+  export let api_request_params = {};
 
   function gotoCoordinates(newlat, newlon, newzoom) {
     if (newlat === null || newlon === null) return;
@@ -36,6 +37,9 @@
     }
   }
 
+  function set_api_param(e) {
+    document.querySelector('input[name=' + e.target.dataset.apiParam + ']').value = e.target.value;
+  }
 </script>
 
 <UrlSubmitForm page="reverse">
            class="form-control form-control-sm d-inline"
            placeholder="latitude"
            pattern="^-?\d+(\.\d+)?$"
-           autofocus
            bind:value={lat}
            on:change={maybeSplitLatitude} />
   </div>
   <div class="col-auto">
-    <a id="switch-coords"
+    <button id="switch-coords"
        on:click|preventDefault|stopPropagation={() => gotoCoordinates(lon, lat)}
        class="btn btn-outline-secondary btn-sm"
-       title="switch lat and lon">&lt;&gt;</a>
+       title="switch lat and lon">&lt;&gt;</button>
   </div>
   <div class="col-auto">
     <label for="reverse-lon">lon</label>
       {/each}
     </select>
   </div>
+  <input type="hidden"
+         name="layer" value="{api_request_params.layer || ''}" />
   <div class="col-auto">
     <button type="submit" class="btn btn-primary btn-sm mx-1">Search</button>
   </div>
 </UrlSubmitForm>
 
+<!-- Additional options -->
+<details id="searchAdvancedOptions" class="mt-2">
+  <summary><small>Advanced options</small></summary>
+  <ul>
+    <li>
+      <label for="option_layer">Layer</label>
+      <input id="option_layer" name="layer" placeholder="e.g. address,poi,railway,natural,manmade"
+        value="{api_request_params.layer || ''}"
+        data-api-param="layer" on:change={set_api_param}
+        class="form-control form-control-sm d-inline w-auto api-param-setting">
+    </li>
+  </ul>
+</details>
+
 <style>
   label {
     font-size: 0.9rem;
     margin: 5px;
   }
 
+  #searchAdvancedOptions ul {
+    list-style-type: none;
+    padding: 0;
+    font-size: 0.85rem;
+  }
+
+  #searchAdvancedOptions li {
+    display: inline-block;
+    padding: 4px 10px;
+    border-radius: 5px;
+    border: 1px dotted #ccc;
+    margin-right: 1em;
+  }
+
+  #searchAdvancedOptions label {
+    margin-right: 0.5em;
+  }
+
   @media (max-width: 850px) {
     #reverse-lon, #reverse-lat, #reverse-zoom {
       width: 8em;