feat(exams): use template authorship statement settings if applicable

This commit is contained in:
Sarah Vaupel 2021-06-10 14:16:24 +02:00 committed by Gregor Kleen
parent f8a3c13428
commit 57a259d8a2

View File

@ -157,7 +157,7 @@ examForm (Entity _ Course{..}) template csrf = hoist liftHandler $ do
& addAttr "disabled" "disabled"
& setTooltip MsgExamAuthorshipStatementAllowOtherFalseTip
)
( Nothing -- TODO: take value from template
( (bool Nothing (join $ efAuthorshipStatement <$> template) schoolSheetExamAuthorshipStatementAllowOther) -- TODO: allow reverting from template to school definition (e.g. show school definition somewhere else, implement some kind of reset button, at least explain workaround (create new exam -> copy from there)...)
<|> (authorshipStatementDefinitionContent . entityVal <$> mSchoolAuthorshipStatement)
)
)
@ -168,47 +168,9 @@ examForm (Entity _ Course{..}) template csrf = hoist liftHandler $ do
)
( case schoolSheetExamAuthorshipStatementMode of
SchoolAuthorshipStatementModeNone -> Just False
SchoolAuthorshipStatementModeOptional -> Nothing -- TODO: set value according to template
SchoolAuthorshipStatementModeOptional -> is _Just . efAuthorshipStatement <$> template
SchoolAuthorshipStatementModeRequired -> Just True
)
-- <*> optionalActionA
-- ( ( optionalActionA
-- ( areq htmlField
-- (fslI MsgExamAuthorshipStatementCustom)
-- (
-- -- TODO: load custom statement from template
-- -- (loading school definition as default is not necessary if it is displayed in form)
-- mempty
-- )
-- )
-- ( if schoolSheetExamAuthorshipStatementAllowOther
-- then fslI MsgExamAuthorshipStatementUseCustomDefinition
-- & setTooltip MsgExamAuthorshipStatementUseCustomDefinitionTip
-- else fslI MsgExamAuthorshipStatementUseCustomDefinition
-- & addAttr "disabled" "disabled"
-- & setTooltip MsgExamAuthorshipStatementUseCustomDefinitionDisabledTip
-- )
-- ( bool (Just False)
-- (Just True) -- TODO: set according to template, if template is empty `Just True`
-- schoolSheetExamAuthorshipStatementAllowOther
-- )
-- )
-- <*> ( aopt htmlField
-- (fslI MsgExamAuthorshipStatementSchoolDefinition & addAttr "disabled" "disabled")
-- ((Just . authorshipStatementDefinitionContent . entityVal) <$> mSchoolAuthorshipStatement)
-- )
-- )
-- ( case schoolSheetExamAuthorshipStatementMode of
-- SchoolAuthorshipStatementModeNone -> fslI MsgExamAuthorshipStatementRequired & addAttr "disabled" "disabled" & setTooltip MsgExamAuthorshipStatementRequiredDisabledOffTip
-- SchoolAuthorshipStatementModeOptional -> fslI MsgExamAuthorshipStatementRequired & setTooltip MsgExamAuthorshipStatementRequiredTip
-- SchoolAuthorshipStatementModeRequired -> fslI MsgExamAuthorshipStatementRequired & addAttr "disabled" "disabled" & setTooltip MsgExamAuthorshipStatementRequiredDisabledOnTip
-- )
-- ( case schoolSheetExamAuthorshipStatementMode of
-- SchoolAuthorshipStatementModeNone -> Just False
-- SchoolAuthorshipStatementModeOptional -> Nothing -- TODO: set value according to template
-- SchoolAuthorshipStatementModeRequired -> Just True
-- )
-- )
officeSchoolsForm :: Maybe (Set SchoolId) -> AForm Handler (Set SchoolId)
officeSchoolsForm mPrev = wFormToAForm $ do