-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from internetofwater/dev
Add intersection process and update skin dashboard templates
- Loading branch information
Showing
8 changed files
with
215 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10284,7 +10284,6 @@ a:focus { | |
} | ||
|
||
.sidebar { | ||
width: 6.5rem; | ||
min-height: 100vh; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
{% extends "_base.html" %} | ||
{% block title %}{{ super() }} {{ data['title'] }} {% endblock %} | ||
{% block crumbs %}{{ super() }} | ||
/ <a href="{{ data['collections_path'] }}">Collections</a> | ||
/ <a href="{{ data['collections_path'] }}">{% trans %}Collections{% endtrans %}</a> | ||
{% for link in data['links'] %} | ||
{% if link.rel == 'collection' %} / | ||
<a href="{{ data['dataset_path'] }}">{{ link['title'] | truncate( 25 ) }}</a> | ||
<a href="{{ data['dataset_path'] }}">{{ link['title'] | string | truncate( 25 ) }}</a> | ||
{% set col_title = link['title'] %} | ||
{% endif %} | ||
{% endfor %} | ||
/ <a href="{{ data['items_path']}}">Items</a> | ||
/ <a href="{{ data['items_path']}}">{% trans %}Items{% endtrans %}</a> | ||
{% endblock %} | ||
{% block extrahead %} | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/> | ||
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script> | ||
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster/dist/MarkerCluster.css"/> | ||
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster/dist/MarkerCluster.Default.css"/> | ||
<script src="https://unpkg.com/leaflet.markercluster/dist/leaflet.markercluster-src.js"></script> | ||
{% endblock %} | ||
|
||
{% block body %} | ||
|
@@ -46,7 +49,7 @@ <h6 class="m-0 font-weight-bold text-primary"> | |
<div id="limit" class="col-sm-12"> | ||
Limit: | ||
<select id="limits"> | ||
<option value="10">10 (default)</option> | ||
<option value="{{ config['server']['limit'] }}">{{ config['server']['limit'] }} ({% trans %}default{% endtrans %})</option> | ||
<option value="100">100</option> | ||
<option value="1000">1,000</option> | ||
<option value="2000">2,000</option> | ||
|
@@ -85,36 +88,62 @@ <h6 class="m-0 font-weight-bold text-primary"> | |
</h6> | ||
</div> | ||
<!-- Card Body --> | ||
<div> | ||
<div style="overflow-x: scroll;"> | ||
{% set props = [] %} | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>id</th> | ||
{% if data['title_field'] %} | ||
<th>{{ data['title_field'] }}</th> | ||
{% if data.get('uri_field') %} | ||
{% set uri_field = data.uri_field %} | ||
<th>{{ uri_field }}</th> | ||
{% elif data.get('title_field') %} | ||
{% set title_field = data.title_field %} | ||
<th>{{ title_field }}</th> | ||
{% else %} | ||
<th>id</th> | ||
{% endif %} | ||
{% for k, v in data['features'][0]['properties'].items() %} | ||
{# start with id & title then take first 5 columns for table #} | ||
{% if loop.index < 5 and k != data['id_field'] and k != data['title_field'] %} | ||
<th>{{ k }}</th> | ||
|
||
{% for k in data['features'][0]['properties'].keys() %} | ||
{% if k not in [data.id_field, data.title_field, data.uri_field, 'extent'] %} | ||
{% set props = props.append(k) %} | ||
<th>{{ k }}</th> | ||
{% endif %} | ||
{% endfor %} | ||
</tr> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for ft in data['features'] %} | ||
{% for ft in data.features %} | ||
<tr> | ||
<td data-label="id"><a href="{{ ft['properties'][data['uri_field']] }}" title="{{ ft.id }}">{{ ft.id | string | truncate( 12 ) }}</a></td> | ||
{% if data['title_field'] %} | ||
<td data-label="name"><a href="{{ data['items_path']}}/{{ ft['id'] }}" title="{{ ft['properties'][data['title_field']] }}">{{ ft['properties'][data['title_field']] | string | truncate( 35 ) }}</a></td> | ||
{% if data.get('uri_field') %} | ||
{% set uri_field = data.uri_field %} | ||
<td data-label="{{ uri_field }}"> | ||
<a href="{{ ft.properties.get(uri_field) }}" title="{{ ft.properties.get(uri_field) }}"> | ||
{{ ft.properties.get(uri_field) }} | ||
</a> | ||
</td> | ||
{% elif data.get('title_field') %} | ||
{% set title_field = data.title_field %} | ||
<td data-label="{{ title_field }}"> | ||
<a href="{{ data.items_path }}/{{ ft['id'] }}" title="{{ ft.properties.get(title_field) }}"> | ||
{{ ft.properties.get(title_field) | string | truncate( 35 ) }} | ||
</a> | ||
</td> | ||
{% else %} | ||
<td data-label="id"> | ||
<a href="{{ data.items_path }}/{{ ft.id }}" title="{{ ft.id }}"> | ||
{{ ft.id | string | truncate( 12 ) }} | ||
</a> | ||
</td> | ||
{% endif %} | ||
{% for k, v in ft['properties'].items() %} | ||
{% if loop.index < 5 and k not in [data['id_field'], data['title_field'], 'extent'] %} | ||
<td data-label="{{ k }}">{{ v | string | truncate( 35 ) }}</td> | ||
{% endif %} | ||
|
||
{% for prop in props %} | ||
<td data-label="{{ prop }}"> | ||
{{ ft.properties.get(prop, '') | string | truncate( 35 ) }} | ||
</td> | ||
{% endfor %} | ||
|
||
</tr> | ||
{% endfor %} | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
|
@@ -131,25 +160,36 @@ <h6 class="m-0 font-weight-bold text-primary"> | |
|
||
{% block extrafoot %} | ||
{% if data['features'] %} | ||
<script> | ||
var map = L.map('items-map').setView([{{ 45 }}, {{ -75 }}], 5); | ||
map.addLayer(new L.TileLayer( | ||
'{{ config['server']['map']['url'] }}', { | ||
maxZoom: 18, | ||
attribution: '{{ config['server']['map']['attribution'] }}' | ||
} | ||
)); | ||
var geojson_data = {{ data['features'] | to_json | safe }}; | ||
var items = new L.GeoJSON(geojson_data, { | ||
onEachFeature: function (feature, layer) { | ||
var url = '{{ data['items_path'] }}/' + feature.id + '?f=html'; | ||
var html = '<span><a href="' + url + '">' + {% if data['title_field'] %} feature['properties']['{{ data['title_field'] }}'] {% else %} feature.id {% endif %} + '</a></span>'; | ||
layer.bindPopup(html); | ||
} | ||
}); | ||
<script> | ||
var map = L.map('items-map').setView([{{ 45 }}, {{ -75 }}], 5); | ||
map.addLayer(new L.TileLayer( | ||
'{{ config['server']['map']['url'] }}', { | ||
maxZoom: 18, | ||
attribution: '{{ config['server']['map']['attribution'] | safe }}' | ||
} | ||
)); | ||
var geojson_data = {{ data['features'] | to_json | safe }}; | ||
|
||
var items = new L.GeoJSON(geojson_data, { | ||
onEachFeature: function (feature, layer) { | ||
var url = '{{ data['items_path'] }}/' + feature.id + '?f=html'; | ||
var html = '<span><a href="' + url + '">' + {% if data['title_field'] %} feature['properties']['{{ data['title_field'] }}'] {% else %} feature.id {% endif %} + '</a></span>'; | ||
layer.bindPopup(html); | ||
} | ||
}); | ||
{% if data['features'][0]['geometry']['type'] == 'Point' %} | ||
var markers = L.markerClusterGroup({ | ||
disableClusteringAtZoom: 9, | ||
chunkedLoading: true, | ||
chunkInterval: 500, | ||
}); | ||
markers.clearLayers().addLayer(items); | ||
map.addLayer(markers); | ||
{% else %} | ||
map.addLayer(items); | ||
{% endif %} | ||
|
||
map.addLayer(items); | ||
map.fitBounds(items.getBounds()); | ||
</script> | ||
map.fitBounds(items.getBounds()); | ||
</script> | ||
{% endif %} | ||
{% endblock %} |
Oops, something went wrong.