Browse Source

Use common group tags for tag autocompletion

This applies the new stored/updated lists of common tags for each group
to the topic-tagging form, both for new submissions as well as editing
the tags on an existing one.
merge-requests/68/head
Deimos 5 years ago
parent
commit
e0ea4e7b6c
  1. 2
      tildes/tildes/templates/intercooler/topic_tags_edit.jinja2
  2. 4
      tildes/tildes/templates/macros/forms.jinja2
  3. 2
      tildes/tildes/templates/new_topic.jinja2

2
tildes/tildes/templates/intercooler/topic_tags_edit.jinja2

@ -12,7 +12,7 @@
data-ic-target="#sidebar .topic-tags"
data-js-remove-on-success
>
{{ topic_tagging(value=topic.tags|join(', '), auto_focus=True) }}
{{ topic_tagging(value=topic.tags|join(', '), auto_focus=True, autocomplete_options=topic.group.common_topic_tags) }}
<div class="form-buttons">
<button class="btn btn-primary" type="submit">Save tags</button>
<button type="button" class="btn btn-link" data-js-cancel-button>Cancel</button>

4
tildes/tildes/templates/macros/forms.jinja2

@ -16,7 +16,7 @@
>{% if text %}{{ text }}{% endif %}</textarea>
{% endmacro %}
{% macro topic_tagging(value=None, auto_focus=False) %}
{% macro topic_tagging(value=None, auto_focus=False, autocomplete_options=None) %}
<div class="form-autocomplete form-group" data-js-autocomplete-container>
<label class="form-label" for="tags">
<span>Tags (optional, comma-separated)</span>
@ -34,7 +34,7 @@
spellcheck="false"
name="query"
placeholder='Tags (like "music, soundtrack, full album")'
data-js-autocomplete-input=""
data-js-autocomplete-input='{{ autocomplete_options|tojson if autocomplete_options }}'
{% if value %} value="{{ value }}"{% endif %}
{% if auto_focus %}data-js-auto-focus{% endif %}
>

2
tildes/tildes/templates/new_topic.jinja2

@ -52,7 +52,7 @@
</div>
</fieldset>
{{ topic_tagging() }}
{{ topic_tagging(autocomplete_options=group.common_topic_tags) }}
<div class="form-buttons">
<button type="submit" class="btn btn-primary">Post topic</button>

Loading…
Cancel
Save