From dbc24abdc1e9d4d7dce8c8ad794c847293a4d512 Mon Sep 17 00:00:00 2001 From: Marc Tobias Metten Date: Thu, 8 Mar 2018 00:36:39 +0100 Subject: [PATCH] display error when server returns error --- build.sh | 2 +- src/assets/css/common.css | 8 ++++++++ src/assets/js/nominatim-ui.js | 18 +++++++++++++++++- src/layout.html | 5 ++++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 1d4870a..964a501 100755 --- a/build.sh +++ b/build.sh @@ -3,7 +3,7 @@ rsync --quiet --recursive src/assets dist/ rsync --quiet --recursive src/vendor/js/* dist/assets/js/ rsync --quiet --recursive src/vendor/css/* dist/assets/css/ -rsync --quiet --recursive src/vendor/images/* dist/assets/images/ +# rsync --quiet --recursive src/vendor/images/* dist/assets/images/ rsync --quiet --recursive src/templates dist/ # rsync --quiet --recursive src/partials dist/ diff --git a/src/assets/css/common.css b/src/assets/css/common.css index e667b9a..7f61a44 100755 --- a/src/assets/css/common.css +++ b/src/assets/css/common.css @@ -40,4 +40,12 @@ footer { footer p { margin: 1em; +} + +#error-overlay { + text-align: center; + font-style: italic; + padding: 2em 4em; + margin: 4em 8em; + background-color: #eee; } \ No newline at end of file diff --git a/src/assets/js/nominatim-ui.js b/src/assets/js/nominatim-ui.js index d6b8c65..5f8eeef 100755 --- a/src/assets/js/nominatim-ui.js +++ b/src/assets/js/nominatim-ui.js @@ -68,6 +68,20 @@ function render_template(el, template_name, page_context) { el.html(html); } +function show_error(html) { + $('#error-overlay').html(html).show(); +} + +function hide_error() { + $('#error-overlay').empty().hide(); +} + + +$(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) { + // console.log(thrownError); + // console.log(ajaxSettings); + show_error('Error fetching results from ' + ajaxSettings.url + ''); +}); /********************************************************* * FORWARD/REVERSE SEARCH PAGE @@ -306,7 +320,9 @@ function init_map_on_search_page(is_reverse_search, nominatim_results, request_l - +jQuery(document).ready(function(){ + hide_error(); +}); diff --git a/src/layout.html b/src/layout.html index 3fef5dd..29522f6 100644 --- a/src/layout.html +++ b/src/layout.html @@ -90,9 +90,12 @@
- You need Javascript enable to view this page.
+
+ You need Javascript enabled to view this page. +
+