Allow supervisors to write a note associated with their projects #8

Merged
ansv7779 merged 10 commits from 3399-supervisor-project-note into develop 2024-07-10 13:43:27 +02:00
2 changed files with 14 additions and 0 deletions
Showing only changes of commit 481d8cd76e - Show all commits

View File

@ -1,6 +1,7 @@
package se.su.dsv.scipro.components;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.ComponentTag;
@ -9,6 +10,7 @@ import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.danekja.java.util.function.serializable.SerializableConsumer;
import java.util.function.Function;
@ -83,4 +85,13 @@ public class ModalWindowPlus extends Panel {
component.setOutputMarkupPlaceholderTag(true);
replace(component);
}
public void onClose(SerializableConsumer<AjaxRequestTarget> onClose) {
add(new AjaxEventBehavior("hidden.bs.modal") {
@Override
protected void onEvent(AjaxRequestTarget target) {
onClose.accept(target);
}
});
}
}

View File

@ -63,6 +63,9 @@ public class ProjectNoteColumn extends AbstractExportableColumn<Project, String>
modal.setContent(componentId -> new ViewAndEditNoteForm(componentId, model));
add(modal);
ansv7779 marked this conversation as resolved
Review

Use of String.format could work here?
Example
modal.setTitle(model.map(Project::getTitle).map(projectTitle -> String.format("View/Edit note for %s", projectTitle)));

What do you think?

Use of String.format could work here? Example ```modal.setTitle(model.map(Project::getTitle).map(projectTitle -> String.format("View/Edit note for %s", projectTitle)));``` What do you think?
Review

Replaced with proper i18n

Replaced with proper i18n
setOutputMarkupId(true);
modal.onClose(target -> target.add(this));
add(new MaxLengthLabel("shortened_note", getDataModel(model)));
AjaxLink<Object> noteLink = new AjaxLink<>("view_note") {