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
3 changed files with 30 additions and 22 deletions
Showing only changes of commit 556abce723 - Show all commits

View File

@ -13,7 +13,7 @@
<label class="form-label" wicket:for="valid_from">
Valid from
</label>
<input type="text" class="form-control" wicket:id="valid_from">
<input required type="text" class="form-control" wicket:id="valid_from">
<small class="text-muted">
When does this grading template take effect.
</small>
@ -38,7 +38,7 @@
</p>
<div class="mb-3">
<label class="form-label" wicket:for="default_grade">Default grade</label>
<input type="text" class="form-control" wicket:id="default_grade">
<input required type="text" class="form-control" wicket:id="default_grade">
<small class="text-muted">The grade they receive if they do not meet the minimum points for any other grade.</small>
</div>
@ -72,13 +72,13 @@
<label class="form-label" wicket:for="title_en">
Title (english)
</label>
<input class="form-control" wicket:id="title_en" type="text">
<input required class="form-control" wicket:id="title_en" type="text">
</div>
<div class="col">
<label class="form-label" wicket:for="title_sv">
Title (swedish)
</label>
<input class="form-control" wicket:id="title_sv" type="text">
<input required class="form-control" wicket:id="title_sv" type="text">
</div>
</div>
@ -103,13 +103,13 @@
<label wicket:for="requirement_en">
Requirement (english)
</label>
<textarea rows="4" class="form-control" wicket:id="requirement_en"></textarea>
<textarea required rows="4" class="form-control" wicket:id="requirement_en"></textarea>
</div>
<div>
<label wicket:for="requirement_sv">
Requirement (swedish)
</label>
<textarea rows="4" class="form-control" wicket:id="requirement_sv"></textarea>
<textarea required rows="4" class="form-control" wicket:id="requirement_sv"></textarea>
</div>
</div>
</fieldset>

View File

@ -9,6 +9,7 @@ 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.NumberTextField;
import org.apache.wicket.markup.html.form.RequiredTextField;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.list.ListItem;
@ -29,7 +30,7 @@ class EditingGradingTemplateComponentPanel extends GenericPanel<EditingGradingTe
{
super(id, editingGradingTemplateModel);
TextField<LocalDate> validFromField = new TextField<>("valid_from",
TextField<LocalDate> validFromField = new RequiredTextField<>("valid_from",
LambdaModel.of(editingGradingTemplateModel,
EditingGradingTemplate::getValidFrom,
EditingGradingTemplate::setValidFrom),
@ -68,7 +69,7 @@ class EditingGradingTemplateComponentPanel extends GenericPanel<EditingGradingTe
setOutputMarkupId(true);
add(new TextField<>("title_sv", LambdaModel.of(
add(new RequiredTextField<>("title_sv", LambdaModel.of(
model,
EditingGradingTemplate.Criteria::getTitleSv,
EditingGradingTemplate.Criteria::setTitleSv)) {
@ -76,7 +77,7 @@ class EditingGradingTemplateComponentPanel extends GenericPanel<EditingGradingTe
add(new AutoSave());
}
});
add(new TextField<>("title_en", LambdaModel.of(
add(new RequiredTextField<>("title_en", LambdaModel.of(
model,
EditingGradingTemplate.Criteria::getTitleEn,
EditingGradingTemplate.Criteria::setTitleEn)) {
@ -106,6 +107,10 @@ class EditingGradingTemplateComponentPanel extends GenericPanel<EditingGradingTe
add(flagChoice);
add(new ListView<>("points", model.map(EditingGradingTemplate.Criteria::getPoints)) {
{
setReuseItems(true);
}
@Override
protected void populateItem(ListItem<EditingGradingTemplate.Criteria.Point> item) {
item.add(new PointEditingPanel("point", item));
@ -138,23 +143,21 @@ class EditingGradingTemplateComponentPanel extends GenericPanel<EditingGradingTe
add(new Label("point", () -> item.getIndex() + 1));
add(new TextArea<>("requirement_en", LambdaModel.of(
TextArea<String> englishRequirement = new TextArea<>("requirement_en", LambdaModel.of(
model,
EditingGradingTemplate.Criteria.Point::getRequirementEn,
EditingGradingTemplate.Criteria.Point::setRequirementEn)) {
{
add(new AutoSave());
}
});
EditingGradingTemplate.Criteria.Point::setRequirementEn));
englishRequirement.setRequired(true);
englishRequirement.add(new AutoSave());
add(englishRequirement);
add(new TextArea<>("requirement_sv", LambdaModel.of(
TextArea<String> swedishRequirement = new TextArea<>("requirement_sv", LambdaModel.of(
model,
EditingGradingTemplate.Criteria.Point::getRequirementSv,
EditingGradingTemplate.Criteria.Point::setRequirementSv)) {
{
add(new AutoSave());
}
});
EditingGradingTemplate.Criteria.Point::setRequirementSv));
swedishRequirement.setRequired(true);
swedishRequirement.add(new AutoSave());
add(swedishRequirement);
add(new AjaxLink<>("remove") {
@Override
@ -174,7 +177,7 @@ class EditingGradingTemplateComponentPanel extends GenericPanel<EditingGradingTe
setOutputMarkupId(true);
add(new TextField<>("default_grade", LambdaModel.of(
add(new RequiredTextField<>("default_grade", LambdaModel.of(
model,
GradeLimits::getDefaultGrade,
GradeLimits::setDefaultGrade)) {

View File

@ -1,3 +1,8 @@
Flag.OPPOSITION=Final seminar opposition
Flag.REFLECTION=Reflection
max_points_available=The maximum number of points available is ${max_points_available} with the below criteria.
default_grade.Required=You must set the default grade.
title_sv.Required=You must set the swedish title for all criteria
title_en.Required=You must set the english title for all criteria
requirement_sv.Required=You must set the swedish requirement for every criteria point
requirement_en.Required=You must set the english requirement for every criteria point