Allow changes to the reflection to be made after it's been submitted #13

Merged
ansv7779 merged 20 commits from 3412-supervisor-edit-reflection into develop 2024-11-21 19:20:48 +01:00
2 changed files with 25 additions and 4 deletions
Showing only changes of commit 4c1a30a6e5 - Show all commits

View File

@ -49,10 +49,16 @@
</div>
</wicket:fragment>
</div>
<wicket:container wicket:id="reflection">
<div wicket:id="reflection">
<wicket:enclosure>
<div class="alert alert-danger">
<h4 class="alert-heading">Improvements requested</h4>
<wicket:container wicket:id="improvementsNeeded"/>
</div>
</wicket:enclosure>
<a wicket:id="showReflection" href="#">View reflection</a>
<div wicket:id="modal"></div>
</wicket:container>
</div>
</fieldset>
</wicket:panel>
</body>

View File

@ -30,6 +30,7 @@ import se.su.dsv.scipro.finalseminar.FinalSeminar;
import se.su.dsv.scipro.finalseminar.FinalSeminarOpposition;
import se.su.dsv.scipro.finalseminar.FinalSeminarService;
import se.su.dsv.scipro.project.Project;
import se.su.dsv.scipro.reflection.Reflection;
import se.su.dsv.scipro.reflection.ReflectionService;
import se.su.dsv.scipro.report.AbstractGradingCriterion;
import se.su.dsv.scipro.report.GradingCriterion;
@ -265,9 +266,18 @@ public class CriteriaPanel extends GenericPanel<SupervisorGradingReport> {
super(id, author);
this.gradingCriterion = gradingCriterion;
IModel<String> reflection = LoadableDetachableModel.of(() -> {
IModel<Reflection> reflection = LoadableDetachableModel.of(() -> {
Project project = CriteriaPanel.this.getModelObject().getProject();
return reflectionService.getSubmittedReflection(project, author.getObject());
return reflectionService.getReflection(project, author.getObject());
});
IModel<String> improvementsNeeded = reflection.as(Reflection.ImprovementsNeeded.class)
.map(Reflection.ImprovementsNeeded::commentBySupervisor);
add(new MultiLineLabel("improvementsNeeded", improvementsNeeded) {
@Override
protected void onConfigure() {
super.onConfigure();
setVisible(!getDefaultModelObjectAsString().isBlank());
}
});
modal = new LargeModalWindow("modal");
@ -276,6 +286,11 @@ public class CriteriaPanel extends GenericPanel<SupervisorGradingReport> {
IModel<Project> projectModel = CriteriaPanel.this.getModel().map(GradingReport::getProject);
return new ReflectionModalBodyPanel(modalBodyId, projectModel, author);
});
this.setOutputMarkupId(true);
this.setOutputMarkupPlaceholderTag(true);
modal.onClose(target -> {
target.add(ReflectionFeedbackPanel.this);
});
add(modal);
WebMarkupContainer showReflection = new WebMarkupContainer("showReflection") {