Commit 099b8b5 1 parent d01cd06 commit 099b8b5 Copy full SHA for 099b8b5
File tree 3 files changed +14
-2
lines changed
evap/evaluation/templates
3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 213
213
import { setupForms } from "{% static 'js/custom-success-form.js' %}" ;
214
214
215
215
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
+ } )
216
228
</ script >
217
229
218
230
{% block additional_javascript %}{% endblock %}
Original file line number Diff line number Diff line change 19
19
data-bs-toggle ="collapse " href ="#contributor-{{ contribution_result.contributor.id }} "
20
20
aria-controls ="contributor-{{ contribution_result.contributor.id }} ">
21
21
</ 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 >
23
23
</ div >
24
24
< div class ="collapse{% if not collapse_participants or evaluation.participants.count == 0 %} show{% endif %} " id ="contributor-{{ contribution_result.contributor.id }} ">
25
25
< div class ="card-body ">
Original file line number Diff line number Diff line change 83
83
84
84
function count_participants ( ) {
85
85
participant_counter = document . getElementById ( "participant_counter" ) ;
86
- participant_counter . innerHTML = participant_list . items . length ;
86
+ participant_counter . innerText = participant_list . items . length ;
87
87
}
88
88
</ script >
89
89
You can’t perform that action at this time.
0 commit comments