From 3b0e1d570d4000cf386def168400413fb0992753 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Tue, 1 Oct 2019 14:06:03 +0200 Subject: [PATCH] feat(tooltips): replace tooltips --- src/Handler/Exam/Form.hs | 3 ++- src/Handler/ExamOffice/Users.hs | 4 +++- src/Handler/Sheet.hs | 12 +++++++----- src/Handler/Submission.hs | 4 +++- templates/sheetCorrectors/cell.hamlet | 5 +---- templates/sheetShow.hamlet | 4 +--- .../massinput/examCorrectors/cellInvitation.hamlet | 5 +---- .../massinput/examOfficeUsers/cellInvitation.hamlet | 5 +---- .../massinput/submissionUsers/cellInvitation.hamlet | 5 +---- 9 files changed, 20 insertions(+), 27 deletions(-) diff --git a/src/Handler/Exam/Form.hs b/src/Handler/Exam/Form.hs index be151fdda..441b0daf6 100644 --- a/src/Handler/Exam/Form.hs +++ b/src/Handler/Exam/Form.hs @@ -137,7 +137,8 @@ examCorrectorsForm mPrev = wFormToAForm $ do miCell' :: Either UserEmail UserId -> Widget - miCell' (Left email) = + miCell' (Left email) = do + invWarnMsg <- messageI Warning MsgEmailInvitationWarning $(widgetFile "widgets/massinput/examCorrectors/cellInvitation") miCell' (Right userId) = do User{..} <- liftHandler . runDB $ get404 userId diff --git a/src/Handler/ExamOffice/Users.hs b/src/Handler/ExamOffice/Users.hs index 123238812..0a5d3b9bd 100644 --- a/src/Handler/ExamOffice/Users.hs +++ b/src/Handler/ExamOffice/Users.hs @@ -103,7 +103,9 @@ makeExamOfficeUsersForm template = renderWForm FormStandard $ do -> pure . nub $ oldUsers ++ Set.toList newUsers return (res', $(widgetFile "widgets/massinput/examOfficeUsers/add")) miCell' :: Either UserEmail UserId -> Widget - miCell' (Left email) = $(widgetFile "widgets/massinput/examOfficeUsers/cellInvitation") + miCell' (Left email) = do + invWarnMsg <- messageI Warning MsgEmailInvitationWarning + $(widgetFile "widgets/massinput/examOfficeUsers/cellInvitation") miCell' (Right uid) = do User{..} <- liftHandler . runDB $ getJust uid $(widgetFile "widgets/massinput/examOfficeUsers/cellKnown") diff --git a/src/Handler/Sheet.hs b/src/Handler/Sheet.hs index 7d521389f..543865af2 100644 --- a/src/Handler/Sheet.hs +++ b/src/Handler/Sheet.hs @@ -422,11 +422,12 @@ getSShowR tid ssh csh shn = do setTitleI $ prependCourseTitle tid ssh csh $ SomeMessage shn let zipLink = CSheetR tid ssh csh shn SArchiveR visibleFrom = visibleUTCTime SelFormatDateTime <$> sheetVisibleFrom sheet - sheetFrom <- formatTime SelFormatDateTime $ sheetActiveFrom sheet - sheetTo <- formatTime SelFormatDateTime $ sheetActiveTo sheet - hintsFrom <- traverse (formatTime SelFormatDateTime) $ sheetHintFrom sheet - solutionFrom <- traverse (formatTime SelFormatDateTime) $ sheetSolutionFrom sheet - markingText <- runMaybeT $ assertM_ (Authorized ==) (evalAccessCorrector tid ssh csh) >> hoistMaybe (sheetMarkingText sheet) + sheetFrom <- formatTime SelFormatDateTime $ sheetActiveFrom sheet + sheetTo <- formatTime SelFormatDateTime $ sheetActiveTo sheet + hintsFrom <- traverse (formatTime SelFormatDateTime) $ sheetHintFrom sheet + solutionFrom <- traverse (formatTime SelFormatDateTime) $ sheetSolutionFrom sheet + markingText <- runMaybeT $ assertM_ (Authorized ==) (evalAccessCorrector tid ssh csh) >> hoistMaybe (sheetMarkingText sheet) + submissionTip <- messageI Info MsgSheetCorrectorSubmissionsTip $(widgetFile "sheetShow") getSArchiveR :: TermId -> SchoolId -> CourseShorthand -> SheetName -> Handler TypedContent @@ -765,6 +766,7 @@ correctorForm shid = wFormToAForm $ do Right uid -> do User{userEmail, userDisplayName, userSurname} <- liftHandler . runDB $ getJust uid return $ nameEmailWidget userEmail userDisplayName userSurname + invWarnMsg <- messageI Warning MsgEmailInvitationWarning return (res, $(widgetFile "sheetCorrectors/cell")) diff --git a/src/Handler/Submission.hs b/src/Handler/Submission.hs index d3482dc22..a925753dd 100644 --- a/src/Handler/Submission.hs +++ b/src/Handler/Submission.hs @@ -131,7 +131,9 @@ makeSubmissionForm cid msmid uploadMode grouping isLecturer prefillUsers = ident <*> wFormToAForm submittorsForm where miCell' :: Markup -> Either UserEmail UserId -> Widget - miCell' csrf (Left email) = $(widgetFile "widgets/massinput/submissionUsers/cellInvitation") + miCell' csrf (Left email) = do + invWarnMsg <- messageI Warning MsgEmailInvitationWarning + $(widgetFile "widgets/massinput/submissionUsers/cellInvitation") miCell' csrf (Right uid) = do User{..} <- liftHandler . runDB $ getJust uid $(widgetFile "widgets/massinput/submissionUsers/cellKnown") diff --git a/templates/sheetCorrectors/cell.hamlet b/templates/sheetCorrectors/cell.hamlet index 8a497e436..226cdadd9 100644 --- a/templates/sheetCorrectors/cell.hamlet +++ b/templates/sheetCorrectors/cell.hamlet @@ -4,10 +4,7 @@ $case userIdent ^{identWidget} -
-
-
- _{MsgEmailInvitationWarning} + ^{messageTooltip invWarnMsg} $of Right _ ^{identWidget} diff --git a/templates/sheetShow.hamlet b/templates/sheetShow.hamlet index 198a831a6..9f9ddd3e2 100644 --- a/templates/sheetShow.hamlet +++ b/templates/sheetShow.hamlet @@ -28,9 +28,7 @@ $maybe descr <- sheetDescription sheet
_{classifySubmissionMode (sheetSubmissionMode sheet)} $case sheetSubmissionMode sheet $of SubmissionMode True _ -
-
-
_{MsgSheetCorrectorSubmissionsTip} + ^{messageTooltip submissionTip} $of _ $case sheetSubmissionMode sheet $of SubmissionMode True _ diff --git a/templates/widgets/massinput/examCorrectors/cellInvitation.hamlet b/templates/widgets/massinput/examCorrectors/cellInvitation.hamlet index 27c423ad1..df7df418a 100644 --- a/templates/widgets/massinput/examCorrectors/cellInvitation.hamlet +++ b/templates/widgets/massinput/examCorrectors/cellInvitation.hamlet @@ -3,7 +3,4 @@ $newline never #{email} -
-
-
- _{MsgEmailInvitationWarning} + ^{messageTooltip invWarnMsg} diff --git a/templates/widgets/massinput/examOfficeUsers/cellInvitation.hamlet b/templates/widgets/massinput/examOfficeUsers/cellInvitation.hamlet index f498aff5e..497c6a4e4 100644 --- a/templates/widgets/massinput/examOfficeUsers/cellInvitation.hamlet +++ b/templates/widgets/massinput/examOfficeUsers/cellInvitation.hamlet @@ -3,7 +3,4 @@ #{email} -
-
-
- _{MsgEmailInvitationWarning} + ^{messageTooltip invWarnMsg} diff --git a/templates/widgets/massinput/submissionUsers/cellInvitation.hamlet b/templates/widgets/massinput/submissionUsers/cellInvitation.hamlet index 6050ac678..abf56ba79 100644 --- a/templates/widgets/massinput/submissionUsers/cellInvitation.hamlet +++ b/templates/widgets/massinput/submissionUsers/cellInvitation.hamlet @@ -4,7 +4,4 @@ #{email} -
-
-
- _{MsgEmailInvitationWarning} + ^{messageTooltip invWarnMsg}