From: Sarah Hoffmann Date: Fri, 30 Oct 2020 16:15:22 +0000 (+0100) Subject: Add interface for setting advanced search options (#38) X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/commitdiff_plain/13014639687c0607d0a617ffebc68d9d529a69da Add interface for setting advanced search options (#38) * add interface for setting advanced search options --- diff --git a/dist/assets/css/search.css b/dist/assets/css/search.css index 7026a38..49c2007 100755 --- a/dist/assets/css/search.css +++ b/dist/assets/css/search.css @@ -10,6 +10,8 @@ .tab-content { border: 1px solid #ddd; border-top: none; + display: flex; + align-items: baseline } form #q { @@ -156,3 +158,17 @@ form #q { label { font-weight: normal; } + +#searchAdvancedOptionsContent { + display: flex; + flex-direction: column; + padding: 0 10px +} + +#searchAdvancedOptionsContent label { + padding: 0 3px; +} + +#searchAdvancedOptionsContent span { + padding: 4px 10px; +} diff --git a/dist/assets/js/nominatim-ui.js b/dist/assets/js/nominatim-ui.js index ea301b5..54eaa75 100644 --- a/dist/assets/js/nominatim-ui.js +++ b/dist/assets/js/nominatim-ui.js @@ -331,7 +331,7 @@ function display_map_position(mouse_lat_lng) { }; $('#switch-to-reverse').attr('href', 'reverse.html?' + $.param(reverse_params)); - $('input#use_viewbox').trigger('change'); + $('input.api-param-setting').trigger('change'); } function init_map_on_search_page(is_reverse_search, nominatim_results, request_lat, @@ -456,6 +456,23 @@ function init_map_on_search_page(is_reverse_search, nominatim_results, request_l update_viewbox_field(); }); + $('input#option_bounded').on('change', function () { + $('input[name=bounded]') + .val($('input#option_bounded') + .prop('checked') ? '1' : ''); + }); + + $('input#option_dedupe').on('change', function () { + $('input[name=dedupe]') + .val($('input#option_dedupe') + .prop('checked') ? '' : '0'); + }); + + $('input[data-api-param]').on('change', function (e) { + $('input[name=' + $(e.target).data('api-param') + ']').val(e.target.value); + }); + + function get_result_element(position) { return $('.result').eq(position); } @@ -667,6 +684,12 @@ function search_page_load() { postalcode: search_params.get('postalcode'), polygon_geojson: get_config_value('Search_AreaPolygons', false) ? 1 : 0, viewbox: search_params.get('viewbox'), + bounded: search_params.get('bounded'), + dedupe: search_params.get('dedupe'), + 'accept-language': search_params.get('accept-language'), + countrycodes: search_params.get('countrycodes'), + limit: search_params.get('limit'), + polygon_threshold: search_params.get('polygon_threshold'), exclude_place_ids: search_params.get('exclude_place_ids'), format: 'jsonv2' }; @@ -674,6 +697,12 @@ function search_page_load() { context = { sQuery: api_request_params.q, sViewBox: search_params.get('viewbox'), + sBounded: search_params.get('bounded'), + sDedupe: search_params.get('dedupe'), + sLang: search_params.get('accept-language'), + sCCode: search_params.get('countrycodes'), + sLimit: search_params.get('limit'), + sPolyThreshold: search_params.get('polygon_threshold'), env: {} }; diff --git a/dist/deletable.html b/dist/deletable.html index 9064234..a33aa38 100644 --- a/dist/deletable.html +++ b/dist/deletable.html @@ -157,11 +157,12 @@
-
- - -
+ + + + + +
@@ -189,13 +190,45 @@
+ + + + + + +
+ + + + +
+
- - + + + + +
-
- +
+ + + + +
+
+ + + + +
+
diff --git a/dist/details.html b/dist/details.html index 9064234..a33aa38 100644 --- a/dist/details.html +++ b/dist/details.html @@ -157,11 +157,12 @@
-
- - -
+ + + + + +
@@ -189,13 +190,45 @@
+ + + + + + +
+ + + + +
+
- - + + + + +
-
- +
+ + + + +
+
+ + + + +
+
diff --git a/dist/polygons.html b/dist/polygons.html index 9064234..a33aa38 100644 --- a/dist/polygons.html +++ b/dist/polygons.html @@ -157,11 +157,12 @@
-
- - -
+ + + + + +
@@ -189,13 +190,45 @@
+ + + + + + +
+ + + + +
+
- - + + + + +
-
- +
+ + + + +
+
+ + + + +
+
diff --git a/dist/reverse.html b/dist/reverse.html index 9064234..a33aa38 100644 --- a/dist/reverse.html +++ b/dist/reverse.html @@ -157,11 +157,12 @@
-
- - -
+ + + + + +
@@ -189,13 +190,45 @@
+ + + + + + +
+ + + + +
+
- - + + + + +
-
- +
+ + + + +
+
+ + + + +
+
diff --git a/dist/search.html b/dist/search.html index 9064234..a33aa38 100644 --- a/dist/search.html +++ b/dist/search.html @@ -157,11 +157,12 @@
-
- - -
+ + + + + +
@@ -189,13 +190,45 @@
+ + + + + + +
+ + + + +
+
- - + + + + +
-
- +
+ + + + +
+
+ + + + +
+
diff --git a/src/assets/css/search.css b/src/assets/css/search.css index 7026a38..49c2007 100755 --- a/src/assets/css/search.css +++ b/src/assets/css/search.css @@ -10,6 +10,8 @@ .tab-content { border: 1px solid #ddd; border-top: none; + display: flex; + align-items: baseline } form #q { @@ -156,3 +158,17 @@ form #q { label { font-weight: normal; } + +#searchAdvancedOptionsContent { + display: flex; + flex-direction: column; + padding: 0 10px +} + +#searchAdvancedOptionsContent label { + padding: 0 3px; +} + +#searchAdvancedOptionsContent span { + padding: 4px 10px; +} diff --git a/src/assets/js/searchpage.js b/src/assets/js/searchpage.js index 95d842d..38a9cf8 100755 --- a/src/assets/js/searchpage.js +++ b/src/assets/js/searchpage.js @@ -45,7 +45,7 @@ function display_map_position(mouse_lat_lng) { }; $('#switch-to-reverse').attr('href', 'reverse.html?' + $.param(reverse_params)); - $('input#use_viewbox').trigger('change'); + $('input.api-param-setting').trigger('change'); } function init_map_on_search_page(is_reverse_search, nominatim_results, request_lat, @@ -170,6 +170,23 @@ function init_map_on_search_page(is_reverse_search, nominatim_results, request_l update_viewbox_field(); }); + $('input#option_bounded').on('change', function () { + $('input[name=bounded]') + .val($('input#option_bounded') + .prop('checked') ? '1' : ''); + }); + + $('input#option_dedupe').on('change', function () { + $('input[name=dedupe]') + .val($('input#option_dedupe') + .prop('checked') ? '' : '0'); + }); + + $('input[data-api-param]').on('change', function (e) { + $('input[name=' + $(e.target).data('api-param') + ']').val(e.target.value); + }); + + function get_result_element(position) { return $('.result').eq(position); } @@ -381,6 +398,12 @@ function search_page_load() { postalcode: search_params.get('postalcode'), polygon_geojson: get_config_value('Search_AreaPolygons', false) ? 1 : 0, viewbox: search_params.get('viewbox'), + bounded: search_params.get('bounded'), + dedupe: search_params.get('dedupe'), + 'accept-language': search_params.get('accept-language'), + countrycodes: search_params.get('countrycodes'), + limit: search_params.get('limit'), + polygon_threshold: search_params.get('polygon_threshold'), exclude_place_ids: search_params.get('exclude_place_ids'), format: 'jsonv2' }; @@ -388,6 +411,12 @@ function search_page_load() { context = { sQuery: api_request_params.q, sViewBox: search_params.get('viewbox'), + sBounded: search_params.get('bounded'), + sDedupe: search_params.get('dedupe'), + sLang: search_params.get('accept-language'), + sCCode: search_params.get('countrycodes'), + sLimit: search_params.get('limit'), + sPolyThreshold: search_params.get('polygon_threshold'), env: {} }; diff --git a/src/templates/searchpage.hbs b/src/templates/searchpage.hbs index 6ed8203..c8f5281 100644 --- a/src/templates/searchpage.hbs +++ b/src/templates/searchpage.hbs @@ -36,11 +36,12 @@
-
- - -
+ + + + + +
@@ -68,13 +69,45 @@
+ + + + + + +
+ + + + +
+
- - + + + + +
-
- +
+ + + + +
+
+ + + + +
+