Merge remote-tracking branch 'origin/master' into feature/unauth_content
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
{% load widget_tweaks %}
|
||||
|
||||
<div class="LP-Input {% if field.errors %} LP-Input--error {% endif %}">
|
||||
<div class="LP-Input {% if classes%}{{classes}}{% endif %} {% if field.errors %} LP-Input--error {% endif %}">
|
||||
<label for="{{field.id_for_label}}" class="LP-Input__Label">{{field.label}}</label>
|
||||
{% render_field field class="LP-Input__Field"%}
|
||||
{% with class="LP-Input__Field "%}
|
||||
{% render_field field class=class%}
|
||||
{% endwith %}
|
||||
|
||||
<span class="LP-Input__Message">
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors%}
|
||||
{{error}}
|
||||
{% endfor %}
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors%}
|
||||
{{error}}
|
||||
{% endfor %}
|
||||
{% elif field.help_text%}
|
||||
{{ field.help_text }}
|
||||
{{ field.help_text }}
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
66
lostplaces/lostplaces_app/templates/partials/tagging.html
Normal file
66
lostplaces/lostplaces_app/templates/partials/tagging.html
Normal file
@@ -0,0 +1,66 @@
|
||||
<div class="LP-TagList">
|
||||
<ul class="LP-TagList__List">
|
||||
{% for tag in tag_list %}
|
||||
<li class="LP-TagList__Item">
|
||||
<div class="LP-Tag">
|
||||
<a href="#" class="LP-Link">
|
||||
<span class="LP-Link__Text">{{tag}}</span>
|
||||
</a>
|
||||
{% if request.user and request.user == config.tagged_item.submitted_by %}
|
||||
<a href="{% url config.delete_url_name tagged_id=config.tagged_item.id tag_id=tag.id %}" class="LP-Link">
|
||||
<span class="LP-Tag__Remove RV-Iconized__Container RV-Iconized__Container--extraSmall">
|
||||
<svg class="RV-Iconized__Icon" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M19 6.4L17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z">
|
||||
</path>
|
||||
</svg>
|
||||
</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<form id="id_tag_submit_form" class="LP-Form LP-Form--inline LP-Form--tagging" method="POST" action="{{config.submit_url}}">
|
||||
<fieldset class="LP-Form__Fieldset">
|
||||
<legend class="LP-Form__Legend">Tags hinzufügen</legend>
|
||||
{% csrf_token %}
|
||||
<div class="LP-Form__Composition LP-Form__Composition--breakable">
|
||||
<div class="LP-Form__Field LP-Form__Button LP-Input LP-Input--tagging">
|
||||
<button id="id_tag_submit_button" class="LP-Button"> Tags hinzufügen</button>
|
||||
</div>
|
||||
<div class="LP-Form__Field">
|
||||
{% include 'partials/form/inputField.html' with field=config.submit_form.tag_list classes="LP-Input--tagging" %}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
const input = document.getElementById('{{config.submit_form.tag_list.auto_id}}')
|
||||
const submit_form = document.getElementById('id_tag_submit_form')
|
||||
const submit_button = document.getElementById('id_tag_submit_button')
|
||||
|
||||
submit_form.onsubmit = () => false
|
||||
|
||||
const tagify = new Tagify(input, {
|
||||
'whitelist': [
|
||||
{% for tag in all_tags %}
|
||||
'{{tag}}',
|
||||
{% endfor %}
|
||||
]
|
||||
})
|
||||
|
||||
const on_form_submit = function() {
|
||||
concat_value = ''
|
||||
console.log(tagify)
|
||||
concat_value = tagify.value.map(value => value.value).join(',')
|
||||
console.log(concat_value)
|
||||
input.value = concat_value
|
||||
submit_form.submit()
|
||||
}
|
||||
|
||||
submit_button.onclick = on_form_submit
|
||||
</script>
|
Reference in New Issue
Block a user