-
Notifications
You must be signed in to change notification settings - Fork 2k
/
package_basic_fields.html
56 lines (49 loc) · 3.18 KB
/
package_basic_fields.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{% import 'macros/form.html' as form %}
{{ form.input('title', id='field-title', label=_('Title'), placeholder=_('eg. A descriptive title'), value=data.title, error=errors.title, classes=['control-full', 'control-large'], attrs={'data-module': 'slug-preview-target'}) }}
{% set prefix = h.url_for(controller='package', action='read', id='') %}
{% set domain = h.url_for(controller='package', action='read', id='', qualified=true) %}
{% set domain = domain|replace("http://", "")|replace("https://", "") %}
{% set attrs = {'data-module': 'slug-preview-slug', 'data-module-prefix': domain, 'data-module-placeholder': '<dataset>'} %}
{{ form.prepend('name', id='field-name', label=_('URL'), prepend=prefix, placeholder=_('eg. my-dataset'), value=data.name, error=errors.name, attrs=attrs) }}
{{ form.markdown('notes', id='field-notes', label=_('Description'), placeholder=_('eg. Some useful notes about the data'), value=data.notes, error=errors.notes) }}
{% set tag_attrs = {'data-module': 'autocomplete', 'data-module-tags': '', 'data-module-source': '/api/2/util/tag/autocomplete?incomplete=?'} %}
{{ form.input('tag_string', id='field-tags', label=_('Tags'), placeholder=_('eg. economy, mental health, government'), value=data.tag_string, error=errors.tags, classes=['control-full'], attrs=tag_attrs) }}
<div class="control-group">
{% set error = errors.license_id %}
<label class="control-label" for="field-license">{{ _("License") }}</label>
<div class="controls">
<select id="field-license" name="license_id" data-module="autocomplete">
{% for licence_desc, licence_id in licences|sort if licence_desc %}
<option value="{{ licence_id }}" {% if data.get('license_id', 'notspecified') == licence_id %}selected="selected"{% endif %}>{{ licence_desc }}</option>
{% endfor %}
</select>
{% if error %}<span class="error-block">{{ error }}</span>{% endif %}
<span class="info-block info-inline">
<i class="icon-large icon-info-sign"></i>
{% trans %}
License definitions and additional information can be found
at <a href="http://opendefinition.org/licenses/">opendefinition.org</a>
{% endtrans %}
</span>
</div>
</div>
{# 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 %}
{% if h.check_access('sysadmin') or data.get('state', 'draft').startswith('draft') or data.get('state', 'none') == 'none' %}
{% set organizations_available = h.organizations_available('create_dataset') %}
{% if organizations_available %}
<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">
<option value="">{{ _('Select an organization...') }}</option>
{% for organization in organizations_available %}
<option value="{{ organization.id }}"{% if organization.id in [data.owner_org, data.group_id] %} selected="selected"{% endif %}>{{ organization.name }}</option>
{% endfor %}
</select>
</div>
</div>
{% endif %}
{% endif %}