Skip to content

Commit

Permalink
[#Fixes #9945] Do not show the time configuration for raster datasets (
Browse files Browse the repository at this point in the history
…#9947) (#9949)

Co-authored-by: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and mattiagiupponi authored Sep 1, 2022
1 parent 4f35e55 commit ec77b38
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
2 changes: 2 additions & 0 deletions geonode/layers/templates/layouts/panels.html
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@
</div>
</div>
</div>
{% if resource.is_vector %}
<div class="col-xs-12 col-lg-4" id="settings_time_series">
<div class="panel-group">
<div class="panel panel-default">
Expand Down Expand Up @@ -752,6 +753,7 @@
</div>
</div>
</div>
{% endif %}
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion geonode/layers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 22 additions & 21 deletions geonode/templates/metadata_form_js.html
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit ec77b38

Please sign in to comment.