chore(profile): add profile form stub for eo-labels
This commit is contained in:
parent
7611011794
commit
ca1081c996
@ -316,14 +316,17 @@ examOfficeForm :: Maybe ExamOfficeSettings -> AForm Handler ExamOfficeSettings
|
||||
examOfficeForm template = wFormToAForm $ do
|
||||
(_uid, User{userExamOfficeGetSynced,userExamOfficeGetLabels}) <- requireAuthPair
|
||||
userIsExamOffice <- liftHandler . hasReadAccessTo $ ExamOfficeR EOExamsR
|
||||
userExamOfficeLabels <- return $ maybe Set.empty eosettingsLabels template
|
||||
let
|
||||
eoLabelForm :: AForm Handler (Set ExamOfficeLabel)
|
||||
eoLabelForm = pure userExamOfficeLabels -- TODO
|
||||
if userIsExamOffice
|
||||
then aFormToWForm $ liftA2 ExamOfficeSettings
|
||||
( aformSection MsgFormExamOffice
|
||||
*> apopt checkBoxField (fslI MsgExamOfficeGetSynced & setTooltip MsgExamOfficeGetSyncedTip) (eosettingsGetSynced <$> template)
|
||||
)
|
||||
( apopt checkBoxField (fslI MsgExamOfficeGetLabels & setTooltip MsgExamOfficeGetLabelsTip) (eosettingsGetLabels <$> template)
|
||||
)
|
||||
else return . pure . fromMaybe (ExamOfficeSettings userExamOfficeGetSynced userExamOfficeGetLabels) $ template
|
||||
then aFormToWForm $ ExamOfficeSettings
|
||||
<$ aformSection MsgFormExamOffice
|
||||
<*> apopt checkBoxField (fslI MsgExamOfficeGetSynced & setTooltip MsgExamOfficeGetSyncedTip) (eosettingsGetSynced <$> template)
|
||||
<*> apopt checkBoxField (fslI MsgExamOfficeGetLabels & setTooltip MsgExamOfficeGetLabelsTip) (eosettingsGetLabels <$> template)
|
||||
<*> eoLabelForm
|
||||
else return . pure . fromMaybe (ExamOfficeSettings userExamOfficeGetSynced userExamOfficeGetLabels userExamOfficeLabels) $ template
|
||||
|
||||
|
||||
validateSettings :: User -> FormValidator SettingsForm Handler ()
|
||||
@ -363,6 +366,7 @@ postProfileR = do
|
||||
E.&&. userSchool E.^. UserSchoolUser E.==. E.val uid
|
||||
E.&&. userSchool E.^. UserSchoolSchool E.==. school E.^. SchoolId
|
||||
return $ school E.^. SchoolId
|
||||
userExamOfficeLabels <- return Set.empty -- TODO
|
||||
allocs <- runDB $ getAllocationNotifications uid
|
||||
let settingsTemplate = Just SettingsForm
|
||||
{ stgDisplayName = userDisplayName
|
||||
@ -381,6 +385,7 @@ postProfileR = do
|
||||
, stgExamOfficeSettings = ExamOfficeSettings
|
||||
{ eosettingsGetSynced = userExamOfficeGetSynced
|
||||
, eosettingsGetLabels = userExamOfficeGetLabels
|
||||
, eosettingsLabels = userExamOfficeLabels
|
||||
}
|
||||
, stgAllocationNotificationSettings = allocs
|
||||
}
|
||||
@ -401,6 +406,7 @@ postProfileR = do
|
||||
, UserNotificationSettings =. stgNotificationSettings
|
||||
, UserShowSex =. stgShowSex
|
||||
, UserExamOfficeGetSynced =. (stgExamOfficeSettings & eosettingsGetSynced)
|
||||
, UserExamOfficeGetLabels =. (stgExamOfficeSettings & eosettingsGetLabels)
|
||||
] ++ [ UserDisplayEmail =. stgDisplayEmail | userDisplayEmail == stgDisplayEmail ]
|
||||
setAllocationNotifications uid stgAllocationNotificationSettings
|
||||
updateFavourites Nothing
|
||||
|
||||
@ -40,4 +40,5 @@ data ExamOfficeSettings
|
||||
= ExamOfficeSettings
|
||||
{ eosettingsGetSynced :: Bool
|
||||
, eosettingsGetLabels :: Bool
|
||||
, eosettingsLabels :: Set ExamOfficeLabel
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user