--- a/ckanext/example/theme/templates/forms/dataset_form.html +++ b/ckanext/example/theme/templates/forms/dataset_form.html @@ -143,12 +143,18 @@ <dd class="tags-instructions hints">e.g. pollution, rivers, water quality</dd> <dd class="tags-instructions field_error" py:if="errors.get('tag_string', '')">${errors.get('tag_string', '')}</dd> </dl> - <h3>Tags with Vocabulary</h3> - <dl> + <h3 py:if="c.vocab_tags">Tags With Example Vocabulary</h3> + <dl py:if="c.vocab_tags"> <dt class="tags-label"><label class="field_opt" for="tags_vocab">Tags</label></dt> <dd class="tags-field"> - <input class="long autocomplete-tag" id="vocab_tag_string" name="vocab_tag_string" size="60" type="text" - value="${data.get('vocab_tag_string') or ', '.join([tag['name'] for tag in data.get('vocab_tags', [])])}" /> + <select id="vocab_tags" class="chzn-select" name="vocab_tags" size="60" multiple="multiple"> + <py:for each="tag in c.vocab_tags"> + <py:choose test=""> + <option py:when="tag in data.get('vocab_tags_selected', [])" selected="selected" value="${tag}">${tag}</option> + <option py:otherwise="" value="${tag}">${tag}</option> + </py:choose> + </py:for> + </select> </dd> <dd class="tags-instructions instructions basic" i18n:msg="">Similar to standard CKAN tags, but these use a fixed vocabulary.</dd> <dd class="tags-instructions field_error" py:if="errors.get('vocab_tag_string', '')">${errors.get('vocab_tag_string', '')}</dd>