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 15 additions and 4 deletions
Showing only changes of commit 0684919bb2 - Show all commits

View File

@ -4,6 +4,7 @@
<wicket:panel>
<div wicket:id="edit_note_modal"></div>
<span wicket:id="shortened_note"></span>
<wicket:container wicket:id="full_note"></wicket:container>
<a wicket:id="view_note">[view/edit note]</a>
</wicket:panel>
</body>

View File

@ -8,6 +8,7 @@ import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulato
import org.apache.wicket.extensions.markup.html.repeater.data.table.export.AbstractExportableColumn;
import org.apache.wicket.feedback.FencedFeedbackPanel;
import org.apache.wicket.injection.Injector;
import org.apache.wicket.markup.html.basic.MultiLineLabel;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.panel.GenericPanel;
@ -69,11 +70,20 @@ public class ProjectNoteColumn extends AbstractExportableColumn<Project, String>
setOutputMarkupId(true);
modal.onClose(target -> target.add(this));
IModel<Integer> maxLength = supervisorProjectNoteDisplayModel.map(display -> switch (display) {
case FULL -> Integer.MAX_VALUE;
case COMPACT -> 100;
add(new MaxLengthLabel("shortened_note", getDataModel(model), Model.of(100)) {
@Override
protected void onConfigure() {
super.onConfigure();
setVisibilityAllowed(supervisorProjectNoteDisplayModel.getObject() == SupervisorProjectNoteDisplay.COMPACT);
}
});
add(new MultiLineLabel("full_note", getDataModel(model)) {
@Override
protected void onConfigure() {
super.onConfigure();
setVisibilityAllowed(supervisorProjectNoteDisplayModel.getObject() == SupervisorProjectNoteDisplay.FULL);
}
});
add(new MaxLengthLabel("shortened_note", getDataModel(model), maxLength));
AjaxLink<Object> noteLink = new AjaxLink<>("view_note") {
@Override