diff --git a/geonode/context_processors.py b/geonode/context_processors.py index add7156795f..169910e8ef4 100644 --- a/geonode/context_processors.py +++ b/geonode/context_processors.py @@ -192,6 +192,7 @@ def resource_urls(request): GEONODE_APPS_ENABLE=getattr(settings, 'GEONODE_APPS_ENABLE', False), GEONODE_APPS_NAME=getattr(settings, 'GEONODE_APPS_NAME', 'Apps'), GEONODE_APPS_NAV_MENU_ENABLE=getattr(settings, 'GEONODE_APPS_NAV_MENU_ENABLE', False), - CATALOG_METADATA_TEMPLATE=getattr(settings, "CATALOG_METADATA_TEMPLATE", "catalogue/full_metadata.xml") + CATALOG_METADATA_TEMPLATE=getattr(settings, "CATALOG_METADATA_TEMPLATE", "catalogue/full_metadata.xml"), + UI_REQUIRED_FIELDS=getattr(settings, "UI_REQUIRED_FIELDS", []) ) return defaults diff --git a/geonode/layers/templates/layouts/panels.html b/geonode/layers/templates/layouts/panels.html index 3e4cbbb6231..698f493d430 100644 --- a/geonode/layers/templates/layouts/panels.html +++ b/geonode/layers/templates/layouts/panels.html @@ -239,9 +239,19 @@
- + {% if UI_REQUIRED_FIELDS %} + + + {% else %} + + {% endif %} + {% endblock edit_progress %} {% block breadcrumbs %} @@ -253,7 +263,11 @@ {% trans "Location and Licenses" %}{% trans "Other, Optional, Metadata" %}
{% trans "* Field declared Mandatory by the Metadata Schema" %}
")); + var mandatoryWarning = "{% trans "* Field declared Mandatory by the Metadata Schema" %}
" + if (!!$(this).closest('.check-select').length) { + $(e.target).parent().parent().append(gettext(mandatoryWarning)); + } else if (!!$(this).closest('#mdinfo').length) { + $(e.target).parent().append(gettext(mandatoryWarning)); } empty++; } @@ -337,6 +360,7 @@ }; {% endblock onInputChange %} {% block trigger_onInputChange %} + {{UI_REQUIRED_FIELDS}}.forEach(element => $('#' + element).change(onInputChange).change()); $('#category_form').change(onInputChange).change(); $('#id_resource-group').change(onInputChange).change(); document.querySelector('select[name="resource-keywords"]').onchange=onInputChange