Skip to content

Commit

Permalink
merge: #778 from patch
Browse files Browse the repository at this point in the history
  • Loading branch information
alycejenni authored Jun 20, 2024
2 parents a8f9027 + 8a0376b commit 49695e4
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
<div data-module="dataset-visibility">
{% 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 %}

<div class="form-group">
<label for="field-organizations" class="control-label">{{ _('Organization') }}</label>
<div class="controls">
Expand All @@ -46,8 +42,7 @@
</option>
{% 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) %}
Expand Down Expand Up @@ -86,7 +81,7 @@
{% endblock %}
{% endif %}

{% if show_organizations_selector and show_visibility_selector %}
{% if show_organizations_selector or show_visibility_selector %}
</div>
{% endif %}

Expand Down

0 comments on commit 49695e4

Please sign in to comment.