diff --git a/ckanext/nhm/theme/templates/package/snippets/package_basic_fields.html b/ckanext/nhm/theme/templates/package/snippets/package_basic_fields.html index f44dc6b2..bc2b5617 100644 --- a/ckanext/nhm/theme/templates/package/snippets/package_basic_fields.html +++ b/ckanext/nhm/theme/templates/package/snippets/package_basic_fields.html @@ -17,21 +17,17 @@ {% set show_organizations_selector = organizations_available and organizations_available|length > 1 %} {% set show_visibility_selector = dataset_has_organization or (organizations_available and (user_is_sysadmin or dataset_is_draft)) %} - {% if show_organizations_selector and show_visibility_selector %} + {% if show_organizations_selector or show_visibility_selector %}
{% endif %} - {% if show_organizations_selector %} + {% if organizations_available %} + {% set existing_org = data.owner_org or data.group_id %} - {% set nhm_organisation_id = h.get_nhm_organisation_id() %} - - {% if nhm_organisation_id %} - {{ form.hidden('owner_org', value=nhm_organisation_id) }} + {% if organizations_available|length == 1 %} + {{ form.hidden('owner_org', value=organizations_available[0].id) }} {% set dataset_has_organization = True %} {% else %} - - {% set existing_org = data.owner_org or data.group_id %} -
@@ -46,8 +42,7 @@ {% endif %} {% for organization in organizations_available %} - {# get out first org from users list only if there is not an - existing org #} + {# get first org from users list if there is not an existing org #} {% set selected_org = (existing_org and existing_org == organization.id) or (not existing_org and not data.id and organization.id == organizations_available[0].id) %} @@ -86,7 +81,7 @@ {% endblock %} {% endif %} - {% if show_organizations_selector and show_visibility_selector %} + {% if show_organizations_selector or show_visibility_selector %}
{% endif %}