MsgMassInputTip

This commit is contained in:
Gregor Kleen 2019-04-29 09:44:39 +02:00
parent dfec963ecf
commit eb0e1382d0
7 changed files with 16 additions and 9 deletions

View File

@ -133,7 +133,7 @@ CourseLecturerAlreadyAdded email@UserEmail: Es gibt bereits einen Kursverwalter
CourseRegistrationEndMustBeAfterStart: Ende des Anmeldezeitraums muss nach dem Anfang liegen CourseRegistrationEndMustBeAfterStart: Ende des Anmeldezeitraums muss nach dem Anfang liegen
CourseDeregistrationEndMustBeAfterStart: Ende des Abmeldezeitraums muss nach dem Anfang des Anmeldezeitraums liegen CourseDeregistrationEndMustBeAfterStart: Ende des Abmeldezeitraums muss nach dem Anfang des Anmeldezeitraums liegen
CourseUserMustBeLecturer: Aktueller Benutzer muss als Kursverwalter eingetragen sein CourseUserMustBeLecturer: Aktueller Benutzer muss als Kursverwalter eingetragen sein
CourseLecturerRightsIdentical: Alle Sorten von Kursverwalter haben identische Rechte CourseLecturerRightsIdentical: Alle Sorten von Kursverwalter haben identische Rechte.
NoSuchTerm tid@TermId: Semester #{display tid} gibt es nicht. NoSuchTerm tid@TermId: Semester #{display tid} gibt es nicht.
NoSuchSchool ssh@SchoolId: Institut #{display ssh} gibt es nicht. NoSuchSchool ssh@SchoolId: Institut #{display ssh} gibt es nicht.
@ -828,7 +828,7 @@ OccurenceEnd: Ende
ScheduleExists: Dieser Plan existiert bereits ScheduleExists: Dieser Plan existiert bereits
ScheduleExceptions: Termin-Ausnahmen ScheduleExceptions: Termin-Ausnahmen
ScheduleExceptionsTip: Ausfälle überschreiben planmäßiges Stattfinden. Außerplanmäßiges Stattfinden überschreibt Ausfall ScheduleExceptionsTip: Ausfälle überschreiben planmäßiges Stattfinden. Außerplanmäßiges Stattfinden überschreibt Ausfall.
ExceptionKind: Termin ... ExceptionKind: Termin ...
ExceptionKindOccur: Findet statt ExceptionKindOccur: Findet statt
ExceptionKindNoOccur: Findet nicht statt ExceptionKindNoOccur: Findet nicht statt
@ -872,4 +872,6 @@ TutorialNew: Neues Tutorium
TutorialNameTaken tutn@TutorialName: Es existiert bereits anderes Tutorium mit Namen #{tutn} TutorialNameTaken tutn@TutorialName: Es existiert bereits anderes Tutorium mit Namen #{tutn}
TutorialCreated tutn@TutorialName: Tutorium #{tutn} erfolgreich angelegt TutorialCreated tutn@TutorialName: Tutorium #{tutn} erfolgreich angelegt
TutorialEditHeading tutn@TutorialName: #{tutn} bearbeiten TutorialEditHeading tutn@TutorialName: #{tutn} bearbeiten
MassInputTip: Es können mehrere Werte angegeben werden. Werte müssen mit + zur Liste hinzugefügt werden und können mit - wieder entfernt werden. Die Liste wird zunächst nur lokal in Ihrem Browser gespeichert und muss noch zusammen mit dem Rest des Formulars Gesendet werden.

View File

@ -9,6 +9,7 @@ Tutorial json
registerFrom UTCTime Maybe registerFrom UTCTime Maybe
registerTo UTCTime Maybe registerTo UTCTime Maybe
deregisterUntil UTCTime Maybe deregisterUntil UTCTime Maybe
lastChanged UTCTime default='NOW()'
UniqueTutorial course name UniqueTutorial course name
Tutor Tutor
tutorial TutorialId tutorial TutorialId

View File

@ -739,7 +739,7 @@ makeCourseForm miButtonAction template = identifyForm FIDcourse $ \html -> do
lecturerForm :: AForm Handler [Either (UserEmail, Maybe LecturerType) (UserId, LecturerType)] lecturerForm :: AForm Handler [Either (UserEmail, Maybe LecturerType) (UserId, LecturerType)]
lecturerForm = formToAForm . over (mapped._2) pure . over (mapped._1.mapped) (map liftEither . Map.elems) $ massInput lecturerForm = formToAForm . over (mapped._2) pure . over (mapped._1.mapped) (map liftEither . Map.elems) $ massInput
MassInput{..} MassInput{..}
(fslI MsgCourseLecturers & setTooltip MsgCourseLecturerRightsIdentical) (fslI MsgCourseLecturers & setTooltip (UniWorXMessages [SomeMessage MsgCourseLecturerRightsIdentical, SomeMessage MsgMassInputTip]))
True True
(Just . Map.fromList . zip [0..] $ maybe [(Right uid, Just CourseLecturer)] (map unliftEither . cfLecturers) template) (Just . Map.fromList . zip [0..] $ maybe [(Right uid, Just CourseLecturer)] (map unliftEither . cfLecturers) template)
mempty mempty

View File

@ -753,7 +753,7 @@ correctorForm shid = wFormToAForm $ do
postProcess' (Right sheetCorrectorUser, (sheetCorrectorState, sheetCorrectorLoad)) = Right SheetCorrector{..} postProcess' (Right sheetCorrectorUser, (sheetCorrectorState, sheetCorrectorLoad)) = Right SheetCorrector{..}
postProcess' (Left sheetCorrectorInvitationEmail, (sheetCorrectorInvitationState, sheetCorrectorInvitationLoad)) = Left SheetCorrectorInvitation{..} postProcess' (Left sheetCorrectorInvitationEmail, (sheetCorrectorInvitationState, sheetCorrectorInvitationLoad)) = Left SheetCorrectorInvitation{..}
fmap postProcess <$> massInputW MassInput{..} (fslI MsgCorrectors) True (Just . Map.fromList . zip [0..] $ Map.toList loads) fmap postProcess <$> massInputW MassInput{..} (fslI MsgCorrectors & setTooltip MsgMassInputTip) True (Just . Map.fromList . zip [0..] $ Map.toList loads)
getSCorrR, postSCorrR :: TermId -> SchoolId -> CourseShorthand -> SheetName -> Handler Html getSCorrR, postSCorrR :: TermId -> SchoolId -> CourseShorthand -> SheetName -> Handler Html
postSCorrR = getSCorrR postSCorrR = getSCorrR

View File

@ -255,7 +255,7 @@ newTermForm template html = do
= aforced termNewField (fslpI MsgTerm (mr MsgTermPlaceholder)) tid = aforced termNewField (fslpI MsgTerm (mr MsgTermPlaceholder)) tid
| otherwise | otherwise
= areq termNewField (fslpI MsgTerm (mr MsgTermPlaceholder)) Nothing = areq termNewField (fslpI MsgTerm (mr MsgTermPlaceholder)) Nothing
holidayForm = formToAForm . over (mapped._2) pure $ massInputList dayField (const $ "" & addPlaceholder (mr MsgTermHolidayPlaceholder)) (const Nothing) (fslI MsgTermHolidays) True (tftHolidays template) mempty holidayForm = formToAForm . over (mapped._2) pure $ massInputList dayField (const $ "" & addPlaceholder (mr MsgTermHolidayPlaceholder)) (const Nothing) (fslI MsgTermHolidays & setTooltip MsgMassInputTip) True (tftHolidays template) mempty
(result, widget) <- flip (renderAForm FormStandard) html $ Term (result, widget) <- flip (renderAForm FormStandard) html $ Term
<$> tidForm <$> tidForm
<*> areq dayField (fslI MsgTermStartDay & setTooltip MsgTermStartDayTooltip) (tftStart template) <*> areq dayField (fslI MsgTermStartDay & setTooltip MsgTermStartDayTooltip) (tftStart template)

View File

@ -212,7 +212,7 @@ tutorialForm cid template html = do
uid <- liftHandlerT requireAuthId uid <- liftHandlerT requireAuthId
let let
tutorForm = Set.fromList <$> massInputAccumA miAdd' miCell' (\p -> Just . SomeRoute $ cRoute :#: p) miLayout' (fslI MsgTutorialTutors) True (Set.toList . tfTutors <$> template) tutorForm = Set.fromList <$> massInputAccumA miAdd' miCell' (\p -> Just . SomeRoute $ cRoute :#: p) miLayout' (fslI MsgTutorialTutors & setTooltip MsgMassInputTip) True (Set.toList . tfTutors <$> template)
where where
miAdd' :: (Text -> Text) -> FieldView UniWorX -> Form ([UserId] -> FormResult [UserId]) miAdd' :: (Text -> Text) -> FieldView UniWorX -> Form ([UserId] -> FormResult [UserId])
miAdd' nudge submitView csrf = do miAdd' nudge submitView csrf = do
@ -282,6 +282,7 @@ postCTutorialNewR tid ssh csh = do
formResult newTutResult $ \TutorialForm{..} -> do formResult newTutResult $ \TutorialForm{..} -> do
insertRes <- runDB $ do insertRes <- runDB $ do
now <- liftIO getCurrentTime
insertRes <- insertUnique Tutorial insertRes <- insertUnique Tutorial
{ tutorialName = tfName { tutorialName = tfName
, tutorialCourse = cid , tutorialCourse = cid
@ -293,6 +294,7 @@ postCTutorialNewR tid ssh csh = do
, tutorialRegisterFrom = tfRegisterFrom , tutorialRegisterFrom = tfRegisterFrom
, tutorialRegisterTo = tfRegisterTo , tutorialRegisterTo = tfRegisterTo
, tutorialDeregisterUntil = tfDeregisterUntil , tutorialDeregisterUntil = tfDeregisterUntil
, tutorialLastChanged = now
} }
forM_ tfTutors $ \tutor -> case insertRes of forM_ tfTutors $ \tutor -> case insertRes of
Just tutid -> void . insert $ Tutor tutid tutor Just tutid -> void . insert $ Tutor tutid tutor
@ -346,6 +348,7 @@ postTEditR tid ssh csh tutn = do
formResult newTutResult $ \TutorialForm{..} -> do formResult newTutResult $ \TutorialForm{..} -> do
insertRes <- runDB $ do insertRes <- runDB $ do
now <- liftIO getCurrentTime
insertRes <- myReplaceUnique tutid Tutorial insertRes <- myReplaceUnique tutid Tutorial
{ tutorialName = tfName { tutorialName = tfName
, tutorialCourse = cid , tutorialCourse = cid
@ -357,6 +360,7 @@ postTEditR tid ssh csh tutn = do
, tutorialRegisterFrom = tfRegisterFrom , tutorialRegisterFrom = tfRegisterFrom
, tutorialRegisterTo = tfRegisterTo , tutorialRegisterTo = tfRegisterTo
, tutorialDeregisterUntil = tfDeregisterUntil , tutorialDeregisterUntil = tfDeregisterUntil
, tutorialLastChanged = now
} }
deleteWhere [ TutorTutorial ==. tutid ] deleteWhere [ TutorTutorial ==. tutid ]
forM_ tfTutors $ void . insert . Tutor tutid forM_ tfTutors $ void . insert . Tutor tutid

View File

@ -45,7 +45,7 @@ occurencesAForm mPrev = wFormToAForm $ do
miCell' miCell'
(\p -> Just . SomeRoute $ cRoute :#: p) (\p -> Just . SomeRoute $ cRoute :#: p)
miLayout' miLayout'
(fslI MsgScheduleRegular) (fslI MsgScheduleRegular & setTooltip MsgMassInputTip)
False False
(Set.toList . occurencesScheduled <$> mPrev) (Set.toList . occurencesScheduled <$> mPrev)
where where
@ -80,7 +80,7 @@ occurencesAForm mPrev = wFormToAForm $ do
miCell' miCell'
(\p -> Just . SomeRoute $ cRoute :#: p) (\p -> Just . SomeRoute $ cRoute :#: p)
miLayout' miLayout'
(fslI MsgScheduleExceptions & setTooltip MsgScheduleExceptionsTip) (fslI MsgScheduleExceptions & setTooltip (UniWorXMessages [SomeMessage MsgScheduleExceptionsTip, SomeMessage MsgMassInputTip]))
False False
(Set.toList . occurencesExceptions <$> mPrev) (Set.toList . occurencesExceptions <$> mPrev)
where where