fix(exams): prefill with school authship statement in optional mode

This commit is contained in:
Sarah Vaupel 2021-06-19 10:26:35 +02:00 committed by Gregor Kleen
parent bf059a1320
commit 0cd8f4c02f

View File

@ -151,13 +151,13 @@ examForm (Entity _ Course{..}) template csrf = hoist liftHandler $ do
<*> let
reqContentField :: (FieldSettings UniWorX -> FieldSettings UniWorX) -> AForm Handler StoredMarkup
reqContentField ttip = areq htmlField
(fslI MsgExamAuthorshipStatementContent & ttip)
( join $ (efAuthorshipStatement <$> template)
<|> (pure . authorshipStatementDefinitionContent . entityVal <$> mSchoolAuthorshipStatement)
)
forcedContentField = aforced htmlField
(fslI MsgExamAuthorshipStatementContent & setTooltip MsgExamAuthorshipStatementAllowOtherFalseTip)
(maybe mempty (authorshipStatementDefinitionContent . entityVal) mSchoolAuthorshipStatement)
(fslI MsgExamAuthorshipStatementContent & ttip)
( (join $ efAuthorshipStatement <$> template)
<|> (authorshipStatementDefinitionContent . entityVal <$> mSchoolAuthorshipStatement)
)
forcedContentField = aforced htmlField
(fslI MsgExamAuthorshipStatementContent & setTooltip MsgExamAuthorshipStatementAllowOtherFalseTip)
(maybe mempty (authorshipStatementDefinitionContent . entityVal) mSchoolAuthorshipStatement)
contentField ttipReq = bool forcedContentField (reqContentField ttipReq) schoolSheetExamAuthorshipStatementAllowOther
in case schoolSheetExamAuthorshipStatementMode of
SchoolAuthorshipStatementModeNone -> pure Nothing -- suppress display of whole section incl. header