Allow supervisors to write a note associated with their projects #8
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
setOutputMarkupId(true);
|
||||
modal.onClose(target -> target.add(this));
|
||||
|
||||
add(new MaxLengthLabel("shortened_note", getDataModel(model)));
|
||||
|
||||
AjaxLink<Object> noteLink = new AjaxLink<>("view_note") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user
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?
Replaced with proper i18n