forked from ckan/ckanext-scheming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
license.html
33 lines (31 loc) · 1.04 KB
/
license.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
{% import 'macros/form.html' as form %}
{%- set options=[] -%}
{%- if field.get('form_include_blank_choice', false) -%}
{%- do options.append({
'value': '',
'text': ''}) -%}
{%- endif -%}
{%- if field.get('sorted_choices', true) -%}
{%- set licenses = licenses|sort -%}
{%- endif -%}
{%- for license_desc, license_id in licenses -%}
{%- if license_id or not h.scheming_field_required(field) -%}
{%- do options.append({
'value': license_id,
'text': license_desc}) -%}
{%- endif -%}
{%- endfor -%}
{% call form.select(
field.field_name,
id='field-' + field.field_name,
label=h.scheming_language_text(field.label),
options=options,
selected=data.get(field.field_name, field.get('default', 'notspecified')),
error=errors[field.field_name],
classes=['control-medium'],
attrs=field.form_attrs if 'form_attrs' in field else {},
is_required=h.scheming_field_required(field),
)
%}
{%- snippet 'scheming/form_snippets/help_text.html', field=field -%}
{% endcall %}