From 57a259d8a2822ac1c593663e99f6e41163909c91 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 10 Jun 2021 14:16:24 +0200 Subject: [PATCH] feat(exams): use template authorship statement settings if applicable --- src/Handler/Exam/Form.hs | 42 ++-------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/src/Handler/Exam/Form.hs b/src/Handler/Exam/Form.hs index 640f8799f..530bc47b2 100644 --- a/src/Handler/Exam/Form.hs +++ b/src/Handler/Exam/Form.hs @@ -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