forked from ckan/ckanext-scheming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
license.html
37 lines (35 loc) · 1.23 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
34
35
36
37
{% import 'macros/form.html' as form %}
{%- set options=[] -%}
{%- if field.get('form_include_blank_choice', false) -%}
{%- do options.append({
'value': '',
'text': ''}) -%}
{%- endif -%}
{% set existing_license_id = data.get('license_id') %}
{% set licenses = licenses|list + h.license_options(existing_license_id)|list %}
{%- 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=field.get('classes', ['control-medium']),
attrs=field.form_attrs if 'form_attrs' in field else {
"data-module": "autocomplete"
},
is_required=h.scheming_field_required(field),
)
%}
{%- snippet 'scheming/form_snippets/help_text.html', field=field -%}
{% endcall %}