diff --git a/static/stemp_abw/js/map_functions.js b/static/stemp_abw/js/map_functions.js index 0978e767..199482ca 100644 --- a/static/stemp_abw/js/map_functions.js +++ b/static/stemp_abw/js/map_functions.js @@ -162,6 +162,7 @@ $('.switch-input-layer-select-region, .switch-input-layer-select-results').click // Individual layers switches l = layers[id.replace(/cb_(region|results)_/, '')]; + console.log("Adding OR removing from lmap: " + lmap); if (this.checked) lmap.addLayer(l); else lmap.removeLayer(l); }); @@ -344,4 +345,23 @@ area_panel_label.onclick = hideResultLayers; // TODO: Load layers after simulation is finished - +var results_panel_label = document.getElementById('panel-results-label'); +results_panel_label.onclick = function() { + $.ajax({ + url: '/stemp_abw/results/', + type: "GET", + success: function (data) { + if (data !== null) { + console.log('data !== null'); + window.result_map_init(window.maps); + } else { + console.log('data === null'); + } + }, + error: function (page) { + console.log('error'); + showErrorPopup(); + }, + cache: false + }); +}; diff --git a/templates/stemp_abw/map.html b/templates/stemp_abw/map.html index 68ff7abe..915567be 100644 --- a/templates/stemp_abw/map.html +++ b/templates/stemp_abw/map.html @@ -766,4 +766,122 @@

Fehler

+ + {% endblock %} diff --git a/views/__init__.py b/views/__init__.py index 04f5f0ee..84a5b440 100644 --- a/views/__init__.py +++ b/views/__init__.py @@ -53,11 +53,12 @@ def get_context_data(self, **kwargs): # prepare layer data and move result layers to separate context var layer_data = io.prepare_layer_data() + layer_list_results = layer_data['layer_list'] layer_data['layer_list'] = {layer: data for layer, data in layer_data['layer_list'].items() if data['cat'] != 'results'} layer_data['layer_list_results'] = {layer: data - for layer, data in layer_data['layer_list'].items() + for layer, data in layer_list_results.items() if data['cat'] == 'results'} context.update(layer_data)