some tweaks on exam form

This commit is contained in:
anhefti 2019-11-27 10:11:13 +01:00
parent 3e8b52acb9
commit fccfb2ca84
2 changed files with 23 additions and 16 deletions

View file

@ -308,7 +308,8 @@ public class ExamForm implements TemplateComposer {
QuizData.QUIZ_ATTR_START_URL, QuizData.QUIZ_ATTR_START_URL,
FORM_QUIZ_URL_TEXT_KEY, FORM_QUIZ_URL_TEXT_KEY,
exam.startURL) exam.startURL)
.readonly(true)) .readonly(true)
.withInputSpan(7))
.addField(FormBuilder.text( .addField(FormBuilder.text(
QuizData.QUIZ_ATTR_DESCRIPTION, QuizData.QUIZ_ATTR_DESCRIPTION,
@ -316,7 +317,8 @@ public class ExamForm implements TemplateComposer {
exam.description) exam.description)
.asArea() .asArea()
.readonly(true) .readonly(true)
.withInputSpan(6)) .withInputSpan(6)
.withEmptyCellSeparation(false))
.addField(FormBuilder.text( .addField(FormBuilder.text(
Domain.EXAM.ATTR_STATUS + "_display", Domain.EXAM.ATTR_STATUS + "_display",
@ -401,15 +403,18 @@ public class ExamForm implements TemplateComposer {
.withColumn(new ColumnDefinition<>( .withColumn(new ColumnDefinition<>(
Domain.CONFIGURATION_NODE.ATTR_NAME, Domain.CONFIGURATION_NODE.ATTR_NAME,
CONFIG_NAME_COLUMN_KEY, CONFIG_NAME_COLUMN_KEY,
ExamConfigurationMap::getConfigName)) ExamConfigurationMap::getConfigName)
.widthProportion(2))
.withColumn(new ColumnDefinition<>( .withColumn(new ColumnDefinition<>(
Domain.CONFIGURATION_NODE.ATTR_DESCRIPTION, Domain.CONFIGURATION_NODE.ATTR_DESCRIPTION,
CONFIG_DESCRIPTION_COLUMN_KEY, CONFIG_DESCRIPTION_COLUMN_KEY,
ExamConfigurationMap::getConfigDescription)) ExamConfigurationMap::getConfigDescription)
.withColumn(new ColumnDefinition<>( .widthProportion(4))
.withColumn(new ColumnDefinition<ExamConfigurationMap>(
Domain.CONFIGURATION_NODE.ATTR_STATUS, Domain.CONFIGURATION_NODE.ATTR_STATUS,
CONFIG_STATUS_COLUMN_KEY, CONFIG_STATUS_COLUMN_KEY,
this.resourceService::localizedExamConfigStatusName)) this.resourceService::localizedExamConfigStatusName)
.widthProportion(1))
.withDefaultActionIf( .withDefaultActionIf(
() -> editable, () -> editable,
this::viewExamConfigPageAction) this::viewExamConfigPageAction)
@ -483,15 +488,18 @@ public class ExamForm implements TemplateComposer {
.withColumn(new ColumnDefinition<>( .withColumn(new ColumnDefinition<>(
Domain.INDICATOR.ATTR_NAME, Domain.INDICATOR.ATTR_NAME,
INDICATOR_NAME_COLUMN_KEY, INDICATOR_NAME_COLUMN_KEY,
Indicator::getName)) Indicator::getName)
.widthProportion(2))
.withColumn(new ColumnDefinition<>( .withColumn(new ColumnDefinition<>(
Domain.INDICATOR.ATTR_TYPE, Domain.INDICATOR.ATTR_TYPE,
INDICATOR_TYPE_COLUMN_KEY, INDICATOR_TYPE_COLUMN_KEY,
this::indicatorTypeName)) this::indicatorTypeName)
.widthProportion(1))
.withColumn(new ColumnDefinition<>( .withColumn(new ColumnDefinition<>(
Domain.THRESHOLD.REFERENCE_NAME, Domain.THRESHOLD.REFERENCE_NAME,
INDICATOR_THRESHOLD_COLUMN_KEY, INDICATOR_THRESHOLD_COLUMN_KEY,
ExamForm::thresholdsValue)) ExamForm::thresholdsValue)
.widthProportion(4))
.withDefaultActionIf( .withDefaultActionIf(
() -> editable, () -> editable,
() -> actionBuilder () -> actionBuilder
@ -720,7 +728,7 @@ public class ExamForm implements TemplateComposer {
return Constants.EMPTY_NOTE; return Constants.EMPTY_NOTE;
} }
return indicator.thresholds final StringBuilder builder = indicator.thresholds
.stream() .stream()
.reduce( .reduce(
new StringBuilder(), new StringBuilder(),
@ -735,8 +743,9 @@ public class ExamForm implements TemplateComposer {
.append(threshold.value).append(" (").append(threshold.color).append(")") .append(threshold.value).append(" (").append(threshold.color).append(")")
.append("</span>") .append("</span>")
.append(" | "), .append(" | "),
(sb1, sb2) -> sb1.append(sb2)) (sb1, sb2) -> sb1.append(sb2));
.toString(); builder.delete(builder.length() - 3, builder.length() - 1);
return builder.toString();
} }
private Function<PageAction, PageAction> cancelModifyFunction() { private Function<PageAction, PageAction> cancelModifyFunction() {

View file

@ -109,14 +109,12 @@ Label-SeparatorLine {
} }
Label.colordark { Label.colordark {
font: 12px Arial, Helvetica, monospace; font: 12px "Courier New", Courier, monospace;
letter-spacing: 3.25px;
color: #4a4a4a; color: #4a4a4a;
} }
Label.colorlight { Label.colorlight {
font: 12px Arial, Helvetica, monospace; font: 12px "Courier New", Courier, monospace;
letter-spacing: 3.25px;
color: #FFFFFF; color: #FFFFFF;
} }