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 | {% ckan_extends %} {# Remove 'free extras' from the package form. If you're using convert_to/from_extras() as we are with our 'custom_text' field below then you need to remove free extras from the form, or editing your custom field won't work. #} {% block custom_fields %} {% endblock %} {# https://github.com/okfn/ckan/blob/master/ckan/templates/macros/form.html documents the macros for fields #} {% block dataset_fields %} {% if data.groups %} <div class="control-group"> <label class="control-label">Groups/Themes</label> <div class="controls"> {% for group in data.groups %} <label class="checkbox" for="field-group-{{ loop.index0 }}"> <input id="field-group-{{ loop.index0 }}" type="checkbox" name="groups__{{ loop.index0 }}__id" value="{{ group.id }}" checked="checked" /> {{ group.title }} </label> {% endfor %} </div> </div> {% endif %} {% set group_name = 'groups__%s__id' % data.groups|length %} {% set group_attrs = {'data-module': 'autocomplete', 'data-module-source': '/api/2/util/group/autocomplete?q=?', 'data-module-key': 'id', 'data-module-label': 'title'} %} {{ form.input(group_name, label=_('Add Group/Theme'), id="field-group", value=data[group_name], classes=['control-medium'], attrs=group_attrs) }} {% endblock %} |