forked from ckan/ckanext-scheming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
slug.html
33 lines (27 loc) · 1.04 KB
/
slug.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
{% import 'macros/form.html' as form %}
{%- if entity_type == 'dataset' %}
{%- set controller = 'package' -%}
{%- elif entity_type == 'organization' %}
{%- set controller = 'organization' -%}
{%- elif entity_type == 'group' -%}
{%- set controller = 'group' -%}
{%- endif -%}
{%- set module_placeholder = '<' + object_type + '>' -%}
{%- set prefix = h.url_for(object_type + '_read', id='') -%}
{%- set domain = h.url_for(object_type + '_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': module_placeholder } -%}
{{ form.prepend(
field.field_name,
id='field-' + field.field_name,
label=h.scheming_language_text(field.label),
prepend=prefix,
placeholder=h.scheming_language_text(field.form_placeholder),
value=data[field.field_name],
error=errors[field.field_name],
attrs=attrs,
is_required=h.scheming_field_required(field)
) }}