Include projects in group in available list
If a project was inactive or completed it was not included in the "relevant projects" list so that they could never be removed from the group. Now all current projects in the group are always included. If such a project is removed it can however not be added back.
This commit is contained in:
parent
510cf9526f
commit
d68414947a
@ -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()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user