Improve the UX when creating groups as a supervisor #123

Merged
niat8586 merged 9 commits from group-creation-ux into develop 2025-03-05 11:01:37 +01:00
Showing only changes of commit d68414947a - Show all commits

View File

@ -42,8 +42,17 @@ public class EditGroupPanel extends Panel {
feedbackPanel.setOutputMarkupId(true);
add(feedbackPanel);
IModel<List<Project>> availableProjects = LoadableDetachableModel.of(() -> {
Set<Project> projects = new HashSet<>();
projects.addAll(getAllRelevantProjects());
// Have to add the projects that are already in the group to the list of available projects
// since they may not be included in the relevant projects if they're inactive or completed.
// To allow them to be removed from the group, it will not be possible to add them again.
projects.addAll(model.getObject().getProjects());
return projects.stream().toList();
});
add(
new ListView<>("available_projects", LoadableDetachableModel.of(this::getAllRelevantProjects)) {
new ListView<>("available_projects", availableProjects) {
@Override
protected void populateItem(ListItem<Project> item) {
CheckBox checkbox = new CheckBox("selected", new SelectProjectModel(model, item.getModel()));