Allows admins to manage grading report templates #14

Merged
niat8586 merged 41 commits from 3482-new-grading-criteria into develop 2024-10-30 10:05:23 +01:00
4 changed files with 45 additions and 0 deletions
Showing only changes of commit ac3da27733 - Show all commits

View File

@ -34,9 +34,14 @@ class EditingGradingTemplate implements Serializable {
}
class Criteria implements Serializable {
enum Flag {
OPPOSITION, REFLECTION
}
private String titleSv;
private String titleEn;
private List<Point> points;
private Flag flag;
Criteria(GradingCriterionTemplate criteria) {
this.titleSv = criteria.getTitle();
@ -65,6 +70,14 @@ class EditingGradingTemplate implements Serializable {
this.titleEn = titleEn;
}
public Flag getFlag() {
return flag;
}
public void setFlag(Flag flag) {
this.flag = flag;
}
public List<Point> getPoints() {
return points;
}

View File

@ -40,6 +40,12 @@
</div>
</div>
<div class="mb-3">
<label class="form-label" wicket:for="flag">Special flag</label>
<select class="form-control" wicket:id="flag"></select>
<small class="text-muted">You can flag a criteria if it is connected to some other part of the system</small>
</div>
<fieldset>
<legend>Points</legend>

View File

@ -6,6 +6,7 @@ import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.markup.html.GenericWebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.EnumChoiceRenderer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.form.TextField;
@ -14,6 +15,9 @@ import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.GenericPanel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LambdaModel;
import se.su.dsv.scipro.components.AjaxDropDownChoice;
import java.util.List;
class EditingGradingTemplateComponentPanel extends GenericPanel<EditingGradingTemplate> {
EditingGradingTemplateComponentPanel(
@ -66,6 +70,26 @@ class EditingGradingTemplateComponentPanel extends GenericPanel<EditingGradingTe
}
});
AjaxDropDownChoice<EditingGradingTemplate.Criteria.Flag> flagChoice = new AjaxDropDownChoice<>(
"flag",
LambdaModel.of(
model,
EditingGradingTemplate.Criteria::getFlag,
EditingGradingTemplate.Criteria::setFlag),
List.of(EditingGradingTemplate.Criteria.Flag.values()),
new EnumChoiceRenderer<>(this))
{
@Override
public void onNewSelection(
AjaxRequestTarget target,
EditingGradingTemplate.Criteria.Flag objectSelected)
{
// auto save
}
};
flagChoice.setNullValid(true);
add(flagChoice);
add(new ListView<>("points", model.map(EditingGradingTemplate.Criteria::getPoints)) {
@Override
protected void populateItem(ListItem<EditingGradingTemplate.Criteria.Point> item) {

View File

@ -0,0 +1,2 @@
Flag.OPPOSITION=Final seminar opposition
Flag.REFLECTION=Reflection