feat(course enrolement): show proper icons in alerts
This commit is contained in:
parent
56c2fccb84
commit
b2b3895aa9
@ -15,6 +15,6 @@ export const ALERT_ICONS = {
|
|||||||
info: '"\\f05a"',
|
info: '"\\f05a"',
|
||||||
registered: '"\\f274"',
|
registered: '"\\f274"',
|
||||||
userplus: '"\\f234"',
|
userplus: '"\\f234"',
|
||||||
userslash: '"\\f504"',
|
userslash: '"\\f506"',
|
||||||
warning: '"\\f071"',
|
warning: '"\\f071"',
|
||||||
};
|
};
|
||||||
|
|||||||
@ -557,11 +557,11 @@ postCRegisterR tid ssh csh = do
|
|||||||
formResult regResult $ \(mbSfId,codeOk) -> if
|
formResult regResult $ \(mbSfId,codeOk) -> if
|
||||||
| isRegistered -> do
|
| isRegistered -> do
|
||||||
runDB $ deleteBy $ UniqueParticipant aid cid
|
runDB $ deleteBy $ UniqueParticipant aid cid
|
||||||
addMessageI Info MsgCourseDeregisterOk
|
addMessageIconI Info IconEnrolFalse MsgCourseDeregisterOk
|
||||||
| codeOk -> do
|
| codeOk -> do
|
||||||
actTime <- liftIO getCurrentTime
|
actTime <- liftIO getCurrentTime
|
||||||
regOk <- runDB $ insertUnique $ CourseParticipant cid aid actTime mbSfId
|
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
|
| otherwise -> addMessageI Warning MsgCourseSecretWrong
|
||||||
-- addMessage Info $ toHtml $ show regResult -- For debugging only
|
-- addMessage Info $ toHtml $ show regResult -- For debugging only
|
||||||
redirect $ CourseR tid ssh csh CShowR
|
redirect $ CourseR tid ssh csh CShowR
|
||||||
@ -1418,7 +1418,7 @@ postCUserR tid ssh csh uCId = do
|
|||||||
| Just (Entity pId _) <- mRegistration
|
| Just (Entity pId _) <- mRegistration
|
||||||
-> do
|
-> do
|
||||||
runDB $ delete pId
|
runDB $ delete pId
|
||||||
addMessageI Info MsgCourseDeregisterOk
|
addMessageIconI Info IconEnrolFalse MsgCourseDeregisterOk
|
||||||
redirect $ CourseR tid ssh csh CUsersR
|
redirect $ CourseR tid ssh csh CUsersR
|
||||||
| otherwise
|
| otherwise
|
||||||
-> invalidArgs ["User not registered"]
|
-> invalidArgs ["User not registered"]
|
||||||
@ -1432,7 +1432,7 @@ postCUserR tid ssh csh uCId = do
|
|||||||
pId <- runDB . insertUnique $ CourseParticipant cid uid now primaryField
|
pId <- runDB . insertUnique $ CourseParticipant cid uid now primaryField
|
||||||
case pId of
|
case pId of
|
||||||
Just _ -> do
|
Just _ -> do
|
||||||
addMessageI Success MsgCourseRegisterOk
|
addMessageIconI Success IconEnrolTrue MsgCourseRegisterOk
|
||||||
redirect currentRoute
|
redirect currentRoute
|
||||||
Nothing -> invalidArgs ["User already registered"]
|
Nothing -> invalidArgs ["User already registered"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user