Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ybrnr
Copy link
Collaborator

@ybrnr ybrnr commented Feb 10, 2025

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

@janno42
Copy link
Member

janno42 commented Feb 10, 2025

From the issue: "The number should update on field changes."
Can you please add some JS for that? :)

Have a look at https://tom-select.js.org/examples/events/ for the events of the component.

Copy link
Member

@niklasmohrin niklasmohrin left a 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?

Comment on lines +76 to +86
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;
Copy link
Member

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

Comment on lines +24 to +26
<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 %}
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants