{% set default_group_type = h.default_group_type('organization') %} {% block package_basic_fields_title %} {{ ui.input(name='title', label=_('Title'), placeholder=_('eg. A descriptive title'), value=data.title, errors=errors.title, data={'module': 'slug-preview-target'}) }} {% endblock %} {% block package_basic_fields_url %} {%- with domain = h.url_for('dataset.read', id='', qualified=true)|replace("http://", "")|replace("https://", "") -%} {{ ui.input(name='name', label=_('URL'), prefix=h.url_for('dataset.read', id=''), placeholder=_('eg. my-dataset'), value=data.name, errors=errors.name, required=true, data={'module': 'slug-preview-slug', 'module-prefix': domain, 'module-placeholder': ''}) }} {%- endwith %} {% endblock %} {% block package_basic_fields_custom %}{% endblock %} {% block package_basic_fields_description %} {{ ui.markdown(name='notes', label=_('Description'), placeholder=_('eg. Some useful notes about the data'), value=data.notes, errors=errors.notes) }} {% endblock %} {% block package_basic_fields_tags %} {{ ui.input(name='tag_string', id='field-tags', label=_('Tags'), placeholder=_('eg. economy, mental health, government'), value=data.tag_string, errors=errors.tags, data={'module': 'autocomplete', 'module-tags': '', 'module-source': '/api/2/util/tag/autocomplete?incomplete=?'}) }} {% endblock %} {% block package_basic_fields_license %} {%- set license_help_text = ui.field_info(_('License definitions and additional information can be found at opendefinition.org')) -%} {%- call ui.util.call(ui.select_box, name="license_id", id="field-license", label=_("License"), data={"module": "autocomplete"}, errors=errors.license_id, nested_content=license_help_text) -%} {% set existing_license_id = data.get('license_id') %} {% set empty_license = _('Please select the license') %} {% for license_id, license_desc in h.license_options(existing_license_id) %} {% endfor %} {%- endcall %} {% endblock %} {% block package_basic_fields_org %} {# if we have a default group then this wants remembering #} {{ ui.hidden_input(name="groups__0__id", value=data.group_id) if data.group_id }} {% 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_can_update_owner_org = h.can_update_owner_org(data, organizations_available) %} {% set user_is_sysadmin = h.check_access('sysadmin') %} {% set show_organizations_selector = organizations_available and user_can_update_owner_org %} {% set show_visibility_selector = dataset_has_organization or (organizations_available and (user_is_sysadmin or dataset_is_draft)) %}
{% if show_organizations_selector %} {% set existing_org = data.owner_org or data.group_id %} {%- call ui.util.call(ui.select_box, name="owner_org", id="field-organizations", label=h.humanize_entity_type('organization', default_group_type, 'default label') or _('Organization'), data={"module": "autocomplete"}, errors=errors.owner_org) -%} {% if h.check_config_permission('create_unowned_dataset') %} {% 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) %} {% endfor %} {%- endcall %} {% endif %} {% if show_visibility_selector %} {% block package_metadata_fields_visibility %} {{ ui.select(name="private", label=_('Visibility'), selected=data.private|trim, options=[('True', _('Private')), ('False', _('Public'))]) }} {% endblock %} {% endif %}
{% if data.id and h.check_access('package_delete', {'id': data.id}) and data.state != 'active' %} {{ ui.select(name="state", label=_("State"), selected=data.state, errors=errors.state, options=[("active", _("Active")), ("deleted", _("Deleted"))]) }} {% endif %} {% endblock %}