Skip to content

Commit 099b8b5

Browse files
committed
started refactoring
1 parent d01cd06 commit 099b8b5

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

evap/evaluation/templates/base.html

+12
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,18 @@
213213
import { setupForms } from "{% static 'js/custom-success-form.js' %}";
214214

215215
setupForms();
216+
document.querySelectorAll("[data-track-tomselect-count]").forEach(tracker_element => {
217+
218+
trackedElement = document.getElementById(tracker_element.dataset.trackTomselectCount)
219+
220+
tracker_element.on("item_add", function() {
221+
update_count(tracker_element, trackedElement);
222+
});
223+
224+
tomselect_element.on("item_remove", function() {
225+
update_count(tracker_element, trackedElement);
226+
});
227+
})
216228
</script>
217229

218230
{% block additional_javascript %}{% endblock %}

evap/evaluation/templates/evaluation_form_general_questionnaires.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
data-bs-toggle="collapse" href="#contributor-{{ contribution_result.contributor.id }}"
2020
aria-controls="contributor-{{ contribution_result.contributor.id }}">
2121
</a>
22-
<span class="badge rounded-pill badge-btn ms-auto" id="participant_counter">{{ evaluation.participants.count }}</span>
22+
<span class="badge rounded-pill badge-btn ms-auto" data-track-tomselect-count="id_participants">{{ evaluation.participants.count }}</span>
2323
</div>
2424
<div class="collapse{% if not collapse_participants or evaluation.participants.count == 0 %} show{% endif %}" id="contributor-{{ contribution_result.contributor.id }}">
2525
<div class="card-body">

evap/evaluation/templates/evap_evaluation_edit_js.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484
function count_participants(){
8585
participant_counter = document.getElementById("participant_counter");
86-
participant_counter.innerHTML = participant_list.items.length;
86+
participant_counter.innerText = participant_list.items.length;
8787
}
8888
</script>
8989

0 commit comments

Comments
 (0)