From a2c2cdae4935004be14caee904b43e090853384f Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 13 Apr 2019 15:39:07 +0200 Subject: [PATCH] adding the crumbspath as suggested in #93 various improvements in html display; add items list to items page, add link to json in crumbs bar, add description where available --- pygeoapi/api.py | 13 ++++- pygeoapi/static/css/default.css | 17 ++++++- pygeoapi/templates/base.html | 23 ++++++--- pygeoapi/templates/collection.html | 8 +++- pygeoapi/templates/collections.html | 10 +++- pygeoapi/templates/item.html | 66 ++++++++++++++++++-------- pygeoapi/templates/items.html | 73 ++++++++++++++++++++--------- pygeoapi/templates/root.html | 6 ++- 8 files changed, 161 insertions(+), 55 deletions(-) diff --git a/pygeoapi/api.py b/pygeoapi/api.py index 6906bbd..9f21c3a 100644 --- a/pygeoapi/api.py +++ b/pygeoapi/api.py @@ -433,7 +433,7 @@ class API(object): self.config['server']['url'], dataset, next_) }, { 'type': 'application/json', - 'title': 'Collection', + 'title': self.config['datasets'][dataset]['title'], 'rel': 'collection', 'href': '{}/collections/{}'.format( self.config['server']['url'], dataset) @@ -525,8 +525,19 @@ class API(object): }, { 'rel': 'collection', 'type': 'application/json', + 'title': self.config['datasets'][dataset]['title'], 'href': '{}/collections/{}'.format( self.config['server']['url'], dataset) + }, { + 'rel': 'prev', + 'type': 'application/json', + 'href': '{}/collections/{}/items/{}'.format( + self.config['server']['url'], dataset, identifier ) #todo: getPrevious + }, { + 'rel': 'next', + 'type': 'application/json', + 'href': '{}/collections/{}/items/{}'.format( + self.config['server']['url'], dataset, identifier ) #todo: getNext } ] diff --git a/pygeoapi/static/css/default.css b/pygeoapi/static/css/default.css index b521b82..7286aeb 100644 --- a/pygeoapi/static/css/default.css +++ b/pygeoapi/static/css/default.css @@ -6,4 +6,19 @@ header { } main { background-color:white -} \ No newline at end of file +} + +.crumbs { + background-color:rgb(230, 230, 230); + padding: 6px; +} +.crumbs a { + padding-left:10px; + color:black; + text-transform: capitalize; +} + +#items-map { + width: 100%; + height: 400px; + } \ No newline at end of file diff --git a/pygeoapi/templates/base.html b/pygeoapi/templates/base.html index e085aa7..6f2ab68 100644 --- a/pygeoapi/templates/base.html +++ b/pygeoapi/templates/base.html @@ -20,24 +20,35 @@
-
+
+
+ {% block crumbs %} + Home + {% endblock %} + + JSON + +
+
-
-
- {% block body %} - {% endblock %} +
+
+
+ {% block body %} + {% endblock %}
diff --git a/pygeoapi/templates/collection.html b/pygeoapi/templates/collection.html index 75f285e..8e03b77 100644 --- a/pygeoapi/templates/collection.html +++ b/pygeoapi/templates/collection.html @@ -1,10 +1,14 @@ {% extends "base.html" %} {% block title %}{{ super() }} {{ data['title'] }} {% endblock %} +{% block crumbs %}{{ super() }} +Collections +{{ data['title'] }} +{% endblock %} {% block body %}
-

{{ data['title'] }}JSON

+

{{ data['title'] }}

{{ data['description'] }}
-
Browse Features
+
Browse through the items of the collection {{ data['title'] }}

Links

-

Conformance

+

Conformance

+ View the conformance classes of this service
-

Collections

+

Collections

+ View the collections in this service.