-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collapsable box for participants in evaluation form #2388
base: main
Are you sure you want to change the base?
Conversation
From the issue: "The number should update on field changes." Have a look at https://tom-select.js.org/examples/events/ for the events of the component. |
evap/evaluation/templates/evaluation_form_general_questionnaires.html
Outdated
Show resolved
Hide resolved
evap/evaluation/templates/evaluation_form_general_questionnaires.html
Outdated
Show resolved
Hide resolved
evap/evaluation/templates/evaluation_form_general_questionnaires.html
Outdated
Show resolved
Hide resolved
evap/evaluation/templates/evaluation_form_general_questionnaires.html
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test?
let participant_list = document.getElementById("id_participants").tomselect; | ||
participant_list.on("item_add", function() { | ||
count_participants(); | ||
}); | ||
participant_list.on("item_remove", function() { | ||
count_participants(); | ||
}); | ||
|
||
function count_participants(){ | ||
participant_counter = document.getElementById("participant_counter"); | ||
participant_counter.innerHTML = participant_list.items.length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove some specifics from this: Let's make it so that the participant_counter does not need to have a id
anymore and instead it has, say, data-track-tomselect-count="#id_participants"
.
Additionally, we should use innerText
instead of innerHTML
<div class="collapse{% if not collapse_participants or evaluation.participants.count == 0 %} show{% endif %}" id="contributor-{{ contribution_result.contributor.id }}"> | ||
<div class="card-body"> | ||
{% include 'bootstrap_form_field_widget.html' with field=field %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this about contributors here?
implements visual changes suggested by @janno42 in #2333
for non staff users the list is always shown by default. For staff users the list is collapsed by default except when there are no participants