refactor(exams): restruct case wrt. aformSection

This commit is contained in:
Sarah Vaupel 2021-06-19 10:05:03 +02:00 committed by Gregor Kleen
parent 4109db6f81
commit 5c813ed02b

View File

@ -160,14 +160,15 @@ examForm (Entity _ Course{..}) template csrf = hoist liftHandler $ do
(maybe mempty (authorshipStatementDefinitionContent . entityVal) mSchoolAuthorshipStatement) (maybe mempty (authorshipStatementDefinitionContent . entityVal) mSchoolAuthorshipStatement)
contentField ttipReq = bool forcedContentField (reqContentField ttipReq) schoolSheetExamAuthorshipStatementAllowOther contentField ttipReq = bool forcedContentField (reqContentField ttipReq) schoolSheetExamAuthorshipStatementAllowOther
in case schoolSheetExamAuthorshipStatementMode of in case schoolSheetExamAuthorshipStatementMode of
SchoolAuthorshipStatementModeNone -> pure Nothing SchoolAuthorshipStatementModeNone -> pure Nothing -- suppress display of whole section incl. header
SchoolAuthorshipStatementModeOptional -> aformSection MsgExamAuthorshipStatementSection otherMode -> aformSection MsgExamAuthorshipStatementSection
*> optionalActionA *> case otherMode of
(contentField id) SchoolAuthorshipStatementModeOptional -> optionalActionA
(fslI MsgExamAuthorshipStatementRequired & setTooltip MsgExamAuthorshipStatementRequiredTip) (contentField id)
((is _Just . efAuthorshipStatement <$> template) <|> (pure $ is _Just schoolSheetExamAuthorshipStatementDefinition)) (fslI MsgExamAuthorshipStatementRequired & setTooltip MsgExamAuthorshipStatementRequiredTip)
SchoolAuthorshipStatementModeRequired -> aformSection MsgExamAuthorshipStatementSection ((is _Just . efAuthorshipStatement <$> template) <|> (pure $ is _Just schoolSheetExamAuthorshipStatementDefinition))
*> (fmap Just $ contentField (setTooltip MsgExamAuthorshipStatementRequiredDisabledOnTip)) SchoolAuthorshipStatementModeRequired -> fmap Just . contentField $ setTooltip MsgExamAuthorshipStatementRequiredDisabledOnTip
_none -> pure Nothing
officeSchoolsForm :: Maybe (Set SchoolId) -> AForm Handler (Set SchoolId) officeSchoolsForm :: Maybe (Set SchoolId) -> AForm Handler (Set SchoolId)
officeSchoolsForm mPrev = wFormToAForm $ do officeSchoolsForm mPrev = wFormToAForm $ do