|
|
|
@ -10,18 +10,9 @@
|
|
|
|
|
|
|
|
|
|
{% for form in formset %}
|
|
|
|
|
<div class="row">
|
|
|
|
|
{{ form.name }}
|
|
|
|
|
|
|
|
|
|
<div class="rating-container">
|
|
|
|
|
<div class="rating" style="--num-choices: {{ form.rating | length }}">
|
|
|
|
|
{% for radio in form.rating %}
|
|
|
|
|
{{ radio.tag }}
|
|
|
|
|
<label class="rating-point" for="{{ radio.id_for_label }}"></label>
|
|
|
|
|
{% for field in form %}
|
|
|
|
|
{{ field }}
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button class="reset" type="button">Zurücksetzen</button>
|
|
|
|
|
</div>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
|
@ -76,10 +67,10 @@ const registerEvents = row => {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
row.querySelector('.reset').addEventListener('click', event => {
|
|
|
|
|
event.target.parentElement.querySelectorAll('.rating-container > .rating > input').forEach(input => {
|
|
|
|
|
input.checked = false;
|
|
|
|
|
});
|
|
|
|
|
row.querySelector('input[name$=rating]').addEventListener('keydown', event => {
|
|
|
|
|
if (event.key === 'Enter') {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
document.querySelectorAll('.row').forEach(registerEvents);
|
|
|
|
@ -110,9 +101,7 @@ addBtn.addEventListener('click', () => {
|
|
|
|
|
input.dataset.bestMatch = '';
|
|
|
|
|
input.dataset.value = '';
|
|
|
|
|
|
|
|
|
|
row.querySelectorAll('.rating-container > .rating > input').forEach(input => {
|
|
|
|
|
input.checked = false;
|
|
|
|
|
});
|
|
|
|
|
row.querySelector('input[name$=rating]').value = undefined;
|
|
|
|
|
|
|
|
|
|
registerEvents(row);
|
|
|
|
|
|
|
|
|
|