Skip to content
Snippets Groups Projects
Commit ec47ba99 authored by Thorge Petersen's avatar Thorge Petersen
Browse files

Show dataset slug/name in basic field form

parent 71d616a9
No related branches found
No related tags found
1 merge request!50Upgraded to CKAN 2.10
......@@ -10,7 +10,8 @@
{% set error_string = _(_('Title') + ': '+errors.title[0]) if errors.title %}
{{
form.input(
'title', id='field-title',
'title',
id='field-title',
label=_('Title'),
value=data.title,
error=error_string,
......@@ -22,6 +23,25 @@
}}
{% endblock package_basic_fields_title %}
{# field name #}
{% block package_basic_fields_url %}
{% set prefix = h.url_for('dataset.read', id='') %}
{% set domain = h.url_for('dataset.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>', 'class': 'form-control input-sm'} %}
{{
form.prepend('name',
id='field-name',
label=_('URL'),
prepend=prefix,
placeholder=_('eg. my-dataset'),
value=data.name,
error=errors.name,
attrs=attrs,
is_required=true
)
}}
{% endblock %}
{# field note #}
{% block package_basic_fields_description %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment