From 07969fae587820067e764f5b3f5635850c8522e6 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Thu, 5 Oct 2023 12:41:37 +0300 Subject: Add search bar if a there's a URL miss when displaying data. Signed-off-by: Munyoki Kilyungi --- wqflask/wqflask/templates/dataset.html | 39 +++++++++++++++++++++++++ wqflask/wqflask/templates/metadata/dataset.html | 4 --- wqflask/wqflask/views.py | 8 +++++ 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/wqflask/wqflask/templates/dataset.html b/wqflask/wqflask/templates/dataset.html index 94452e9e..244f529e 100644 --- a/wqflask/wqflask/templates/dataset.html +++ b/wqflask/wqflask/templates/dataset.html @@ -26,14 +26,53 @@ content: ":"; } + .search { + width: 50%; + margin: 50px auto; + } + .has-search .form-control-feedback { + right: initial; + left: 0; + color: #ccc; + } + + .has-search .form-control { + padding-right: 12px; + padding-left: 34px; + } {% endblock %} {% block title %}Dataset: {{ name }}{% endblock %} {% block content %} +{% if dataset %} + {% include 'metadata/dataset.html' %} +{% else %} +
+

We appreciate your interest, but unfortunately, we don't have any additional information available for: {{ name }}. If you have any other questions or need assistance with something else, please feel free to reach out to us. In the meantime search for other datasets here:

. + + + + +
+ +
+ + +{% endif %} + {% endblock %} {% block js %} diff --git a/wqflask/wqflask/templates/metadata/dataset.html b/wqflask/wqflask/templates/metadata/dataset.html index 70f2bfb9..dfe58f9b 100644 --- a/wqflask/wqflask/templates/metadata/dataset.html +++ b/wqflask/wqflask/templates/metadata/dataset.html @@ -11,9 +11,6 @@
- {% if metadata == {} %} -

We appreciate your interest, but unfortunately, we don't have any additional information available for: {{ name }}. If you have any other questions or need assistance with something else, please feel free to reach out to us.

- {% else %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index a6f036a8..22b7384c 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -1121,6 +1121,14 @@ def get_dataset(name): float_p=float_p ) +@app.route("/dataset/search", methods=('POST',)) +def search_for_dataset(): + results = {} + search = request.form.get('search') + return render_template( + "metadata/dataset_search_results.html", + results=search + ) @app.route("/publication/", methods=('GET',)) def get_publication(name): -- cgit 1.4.1