Skip to content
Snippets Groups Projects
Commit 2036d01e authored by anonymous's avatar anonymous
Browse files

always select default organisation for new packages

parent f3f45445
Branches
Tags
No related merge requests found
......@@ -103,41 +103,11 @@ is_required=true,placeholder=_('Enter title')) }}
classes=['control-full'], attrs=tag_attrs,
is_required=true, placeholder=_('odsh tags placeholder')) }}
{% endblock %}
{% block package_basic_fields_org %}
{# if we have a default group then this wants remembering #}
{% if data.group_id %}
<input type="hidden" name="groups__0__id" value="{{ data.group_id }}" />
{% endif %}
{% set dataset_is_draft = data.get('state', 'draft').startswith('draft') or data.get('state', 'none') == 'none'
%}
{% set dataset_has_organization = data.owner_org or data.group_id %}
{% set organizations_available = h.organizations_available('create_dataset') %}
{% set user_is_sysadmin = h.check_access('sysadmin') %}
{% set show_organizations_selector = organizations_available %}
{% set show_visibility_selector = dataset_has_organization or (organizations_available and (user_is_sysadmin or
dataset_is_draft)) %}
{% block package_basic_fields_org %}
{% set existing_org = data.owner_org or data.group_id %}
<div class="control-group">
<label for="field-organizations" class="control-label">{{ _('Organization') }}</label>
<div class="controls">
<select id="field-organizations" name="owner_org" data-module="autocomplete">
{% if h.check_config_permission('create_unowned_dataset') %}
<option value="" {% if not selected_org and data.id %} selected="selected" {% endif %}>{{ _('No
organization') }}</option>
{% endif %}
{% for organization in organizations_available %}
{# get out first org from users list only 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) %}
<option value="{{ organization.id }}" {% if selected_org %} selected="selected" {% endif %}>{{
organization.display_name }}</option>
{% endfor %}
</select>
</div>
</div>
<input id="field-organizations" name="owner_org" type="hidden" value="{{ existing_org }}" />
{% endblock %}
<!-- field spatial_extension -->
{{ form.input('spatial_extension', id='field-spatial-extension', label=_('Spatial extension'),
......@@ -173,5 +143,3 @@ is_required=true,placeholder=_('Enter title')) }}
</div>
</div>
{% endif %}
\ No newline at end of file
{% endblock %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment