feat(course-events): add optional note to course events

This commit is contained in:
Sarah Vaupel 2020-03-31 14:07:37 +02:00
parent a4d4c224e9
commit 6ad8f2ee29
6 changed files with 9 additions and 0 deletions

View File

@ -2218,6 +2218,7 @@ CourseEventType: Art
CourseEventTypePlaceholder: Vorlesung, Zentralübung, ...
CourseEventTime: Zeit
CourseEventRoom: Regulärer Raum
CourseEventNote: Notiz
CourseEventActions: Aktionen
CourseEventsActionEdit: Bearbeiten
CourseEventsActionDelete: Löschen

View File

@ -2218,6 +2218,7 @@ CourseEventType: Type
CourseEventTypePlaceholder: Lecture, Exercise discussion, ...
CourseEventTime: Time
CourseEventRoom: Regular room
CourseEventNote: Note
CourseEventActions: Actions
CourseEventsActionEdit: Edit
CourseEventsActionDelete: Delete

View File

@ -30,6 +30,7 @@ CourseEvent
course CourseId
room Text
time Occurrences
note Text Maybe
lastChanged UTCTime default=now()
CourseAppInstructionFile

View File

@ -24,6 +24,7 @@ postCEvEditR tid ssh csh cID = do
, courseEventType = cefType
, courseEventRoom = cefRoom
, courseEventTime = cefTime
, courseEventNote = cefNote
, courseEventLastChanged = now
}
addMessageI Success MsgCourseEventEdited

View File

@ -15,6 +15,7 @@ data CourseEventForm = CourseEventForm
{ cefType :: CI Text
, cefRoom :: Text
, cefTime :: Occurrences
, cefNote :: Maybe Text
}
courseEventForm :: Maybe CourseEventForm -> Form CourseEventForm
@ -34,15 +35,18 @@ courseEventForm template = identifyForm FIDCourseEvent . renderWForm FormStandar
cefType' <- wreq (textField & cfStrip & cfCI & addDatalist courseEventTypes) (fslI MsgCourseEventType & addPlaceholder (mr MsgCourseEventTypePlaceholder)) (cefType <$> template)
cefRoom' <- wreq (textField & cfStrip & addDatalist courseEventRooms) (fslI MsgCourseEventRoom) (cefRoom <$> template)
cefTime' <- aFormToWForm $ occurrencesAForm ("time" :: Text) (cefTime <$> template)
cefNote' <- wopt textField (fslI MsgCourseEventNote) (cefNote <$> template)
return $ CourseEventForm
<$> cefType'
<*> cefRoom'
<*> cefTime'
<*> cefNote'
courseEventToForm :: CourseEvent -> CourseEventForm
courseEventToForm CourseEvent{..} = CourseEventForm
{ cefType = courseEventType
, cefRoom = courseEventRoom
, cefTime = courseEventTime
, cefNote = courseEventNote
}

View File

@ -22,6 +22,7 @@ postCEventsNewR tid ssh csh = do
, courseEventType = cefType
, courseEventRoom = cefRoom
, courseEventTime = cefTime
, courseEventNote = cefNote
, courseEventLastChanged = now
}
encrypt eId :: DB CryptoUUIDCourseEvent