From ec77b38fe2c04f33a9f4bbd7a0995e17a9fd6837 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Thu, 1 Sep 2022 18:15:38 +0200
Subject: [PATCH] [#Fixes #9945] Do not show the time configuration for raster
datasets (#9947) (#9949)
Co-authored-by: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com>
---
geonode/layers/templates/layouts/panels.html | 2 +
geonode/layers/views.py | 2 +-
geonode/templates/metadata_form_js.html | 43 ++++++++++----------
3 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/geonode/layers/templates/layouts/panels.html b/geonode/layers/templates/layouts/panels.html
index 289bd34a6ba..435804aac75 100644
--- a/geonode/layers/templates/layouts/panels.html
+++ b/geonode/layers/templates/layouts/panels.html
@@ -720,6 +720,7 @@
+ {% if resource.is_vector %}
+ {% endif %}
diff --git a/geonode/layers/views.py b/geonode/layers/views.py
index 96d0d67fddb..c94feccb9fe 100644
--- a/geonode/layers/views.py
+++ b/geonode/layers/views.py
@@ -744,7 +744,7 @@ def dataset_metadata(
layer.has_time = dataset_form.cleaned_data.get('has_time', layer.has_time)
- if timeseries_form.cleaned_data and ('has_time' in dataset_form.changed_data or timeseries_form.changed_data):
+ if layer.is_vector() and timeseries_form.cleaned_data and ('has_time' in dataset_form.changed_data or timeseries_form.changed_data):
ts = timeseries_form.cleaned_data
end_attr = layer.attributes.get(pk=ts.get("end_attribute")).attribute if ts.get("end_attribute") else None
start_attr = layer.attributes.get(pk=ts.get("attribute")).attribute if ts.get("attribute") else None
diff --git a/geonode/templates/metadata_form_js.html b/geonode/templates/metadata_form_js.html
index f3408aa23cb..efab2de91b2 100644
--- a/geonode/templates/metadata_form_js.html
+++ b/geonode/templates/metadata_form_js.html
@@ -416,34 +416,35 @@
$(document).ready(function() {
- if($("#id_resource-has_time").is(":checked")) {
- $("#settings_time_series").show();
- if ($("#id_timeseries-presentation").val() == 'LIST') {
- $("#precision_value").hide();
- }
- } else {
- $("#settings_time_series").hide();
- };
-
- $("#id_resource-has_time").click(function() {
- if($(this).is(":checked")) {
+ {% if resource.is_vector %}
+ if($("#id_resource-has_time").is(":checked")) {
$("#settings_time_series").show();
if ($("#id_timeseries-presentation").val() == 'LIST') {
$("#precision_value").hide();
}
} else {
$("#settings_time_series").hide();
- }
- });
-
- $("#id_timeseries-presentation").change(function() {
- if(this.value != 'LIST') {
- $("#precision_value").show();
- } else {
- $("#precision_value").hide();
- }
- });
+ };
+ $("#id_resource-has_time").click(function() {
+ if($(this).is(":checked")) {
+ $("#settings_time_series").show();
+ if ($("#id_timeseries-presentation").val() == 'LIST') {
+ $("#precision_value").hide();
+ }
+ } else {
+ $("#settings_time_series").hide();
+ }
+ });
+
+ $("#id_timeseries-presentation").change(function() {
+ if(this.value != 'LIST') {
+ $("#precision_value").show();
+ } else {
+ $("#precision_value").hide();
+ }
+ });
+ {% endif %}
{% block hints %}
$('#completeness-hints .mandatory-hint').click(getTab.bind(null, 1));