feat(course enrolement): show proper icons in alerts

This commit is contained in:
Steffen Jost 2019-07-25 07:57:27 +02:00
parent 56c2fccb84
commit b2b3895aa9
2 changed files with 5 additions and 5 deletions

View File

@ -15,6 +15,6 @@ export const ALERT_ICONS = {
info: '"\\f05a"',
registered: '"\\f274"',
userplus: '"\\f234"',
userslash: '"\\f504"',
userslash: '"\\f506"',
warning: '"\\f071"',
};

View File

@ -557,11 +557,11 @@ postCRegisterR tid ssh csh = do
formResult regResult $ \(mbSfId,codeOk) -> if
| isRegistered -> do
runDB $ deleteBy $ UniqueParticipant aid cid
addMessageI Info MsgCourseDeregisterOk
addMessageIconI Info IconEnrolFalse MsgCourseDeregisterOk
| codeOk -> do
actTime <- liftIO getCurrentTime
regOk <- runDB $ insertUnique $ CourseParticipant cid aid actTime mbSfId
when (isJust regOk) $ addMessageI Success MsgCourseRegisterOk
when (isJust regOk) $ addMessageIconI Success IconEnrolTrue MsgCourseRegisterOk
| otherwise -> addMessageI Warning MsgCourseSecretWrong
-- addMessage Info $ toHtml $ show regResult -- For debugging only
redirect $ CourseR tid ssh csh CShowR
@ -1418,7 +1418,7 @@ postCUserR tid ssh csh uCId = do
| Just (Entity pId _) <- mRegistration
-> do
runDB $ delete pId
addMessageI Info MsgCourseDeregisterOk
addMessageIconI Info IconEnrolFalse MsgCourseDeregisterOk
redirect $ CourseR tid ssh csh CUsersR
| otherwise
-> invalidArgs ["User not registered"]
@ -1432,7 +1432,7 @@ postCUserR tid ssh csh uCId = do
pId <- runDB . insertUnique $ CourseParticipant cid uid now primaryField
case pId of
Just _ -> do
addMessageI Success MsgCourseRegisterOk
addMessageIconI Success IconEnrolTrue MsgCourseRegisterOk
redirect currentRoute
Nothing -> invalidArgs ["User already registered"]