fix: improve labeling of button to switch exam occurrence
This commit is contained in:
parent
83fa9c9c69
commit
727b89bf4b
@ -13,6 +13,7 @@ BtnCourseApply: Zum Kurs bewerben
|
||||
BtnCourseRetractApplication: Bewerbung zum Kurs zurückziehen
|
||||
BtnExamRegister: Anmelden zur Prüfung
|
||||
BtnExamRegisterOccurrence: Anmelden zum Prüfungstermin/-raum
|
||||
BtnExamSwitchOccurrence: Zu Prüfungstermin/-raum wechseln
|
||||
BtnExamDeregister: Von der Prüfung abmelden
|
||||
BtnHijack: Sitzung übernehmen
|
||||
BtnSave: Speichern
|
||||
|
||||
@ -13,6 +13,7 @@ BtnCourseApply: Apply for course
|
||||
BtnCourseRetractApplication: Retract application
|
||||
BtnExamRegister: Enrol for exam
|
||||
BtnExamRegisterOccurrence: Enrol for exam occurrence/room
|
||||
BtnExamSwitchOccurrence: Switch to exam occurrence/room
|
||||
BtnExamDeregister: Leave exam
|
||||
BtnHijack: Hijack session
|
||||
BtnSave: Save
|
||||
|
||||
@ -14,6 +14,7 @@ import Database.Persist.Sql (deleteWhereCount)
|
||||
|
||||
-- Dedicated ExamRegistrationButton
|
||||
data ButtonExamRegister = BtnExamRegisterOccurrence
|
||||
| BtnExamSwitchOccurrence
|
||||
| BtnExamRegister
|
||||
| BtnExamDeregister
|
||||
deriving (Enum, Bounded, Eq, Ord, Read, Show, Generic, Typeable)
|
||||
@ -23,10 +24,12 @@ nullaryPathPiece ''ButtonExamRegister $ camelToPathPiece' 2
|
||||
|
||||
instance Button UniWorX ButtonExamRegister where
|
||||
btnClasses BtnExamRegisterOccurrence = [BCIsButton, BCPrimary]
|
||||
btnClasses BtnExamSwitchOccurrence = [BCIsButton, BCPrimary]
|
||||
btnClasses BtnExamRegister = [BCIsButton, BCPrimary]
|
||||
btnClasses BtnExamDeregister = [BCIsButton, BCDanger]
|
||||
|
||||
btnLabel BtnExamRegisterOccurrence = [whamlet|#{iconExamRegister True } _{MsgBtnExamRegisterOccurrence}|]
|
||||
btnLabel BtnExamSwitchOccurrence = [whamlet|_{MsgBtnExamSwitchOccurrence}|]
|
||||
btnLabel BtnExamRegister = [whamlet|#{iconExamRegister True } _{MsgBtnExamRegister}|]
|
||||
btnLabel BtnExamDeregister = [whamlet|#{iconExamRegister False} _{MsgBtnExamDeregister}|]
|
||||
|
||||
@ -76,7 +79,7 @@ postERegisterOccR tid ssh csh examn occn = do
|
||||
audit $ TransactionExamDeregister eId uid
|
||||
addMessageIconI Success IconExamRegisterFalse $ MsgExamDeregisteredSuccess examn
|
||||
redirect $ CExamR tid ssh csh examn EShowR
|
||||
BtnExamRegisterOccurrence -> do
|
||||
btn | btn `elem` [BtnExamRegisterOccurrence, BtnExamSwitchOccurrence] -> do
|
||||
runDB $ do
|
||||
now <- liftIO getCurrentTime
|
||||
void $ upsertBy (UniqueExamRegistration eId uid) (ExamRegistration eId uid (Just occId) now) [ExamRegistrationOccurrence =. Just occId, ExamRegistrationTime =. now]
|
||||
|
||||
@ -118,7 +118,7 @@ getEShowR tid ssh csh examn = do
|
||||
, Just (Entity occId ExamOccurrence{..}) <- mOcc
|
||||
, isRegistered <- (== Just occId) $ examRegistrationOccurrence . entityVal =<< join registered
|
||||
, mayRegister' (Just occId) = Just $ do
|
||||
(examRegisterForm, examRegisterEnctype) <- liftHandler . generateFormPost . buttonForm' $ bool [BtnExamRegisterOccurrence] [BtnExamDeregister] isRegistered
|
||||
(examRegisterForm, examRegisterEnctype) <- liftHandler . generateFormPost . buttonForm' $ bool [bool BtnExamRegisterOccurrence BtnExamSwitchOccurrence . is _Just $ join registered] [BtnExamDeregister] isRegistered
|
||||
wrapForm examRegisterForm def
|
||||
{ formAction = Just . SomeRoute . CExamR tid ssh csh examName $ ERegisterOccR examOccurrenceName
|
||||
, formEncoding = examRegisterEnctype
|
||||
|
||||
Loading…
Reference in New Issue
Block a user