chore(lms): better links in lms status widget
This commit is contained in:
parent
50e4f297b8
commit
81b821c88a
@ -255,23 +255,20 @@ lmsStatusIcon LmsSuccess{} = IconOK
|
||||
lmsStatusIcon LmsExpired{} = IconExpired
|
||||
lmsStatusIcon _other = IconNotOK
|
||||
|
||||
lmsUserStatusWidget :: Bool -> LmsUser -> Widget
|
||||
lmsUserStatusWidget adminInfo luser = case luser of
|
||||
lmsUserStatusWidget :: Bool -> Maybe (SomeRoute UniWorX) -> LmsUser -> Widget
|
||||
lmsUserStatusWidget adminInfo mbLink luser = case luser of
|
||||
LmsUser{lmsUserStatus=Just lStat, lmsUserStatusDay=mbDay} ->
|
||||
[whamlet|$newline never
|
||||
$maybe aday <- mbDay
|
||||
^{formatTimeW SelFormatDateTime aday}
|
||||
$nothing
|
||||
--.--.----
|
||||
^{dateWgt mbDay}
|
||||
\ ^{iconFixed (lmsStatusIcon lStat)}
|
||||
$if adminInfo
|
||||
\ ^{lockIcon}
|
||||
\ ^{resetIcon}
|
||||
|]
|
||||
|
||||
LmsUser{lmsUserNotified=Just d} ->
|
||||
LmsUser{lmsUserNotified=mbDay@(Just _)} ->
|
||||
[whamlet|$newline never
|
||||
^{formatTimeW SelFormatDateTime d}
|
||||
^{dateWgt mbDay}
|
||||
\ ^{iconFixed IconNotificationSent}
|
||||
$if adminInfo
|
||||
\ ^{lockIcon}
|
||||
@ -280,7 +277,7 @@ lmsUserStatusWidget adminInfo luser = case luser of
|
||||
|
||||
LmsUser{lmsUserStarted=dstart} | adminInfo -> -- E-Learning started, but not yet notified; only intended for Admins;
|
||||
[whamlet|$newline never
|
||||
^{formatTimeW SelFormatDateTime dstart}
|
||||
^{dateWgt (Just dstart)}
|
||||
\ ^{iconFixed IconPlanned}
|
||||
$if adminInfo
|
||||
\ ^{resetIcon}
|
||||
@ -297,3 +294,8 @@ lmsUserStatusWidget adminInfo luser = case luser of
|
||||
resetIcon
|
||||
| lmsUserResetTries luser = iconFixed IconResetTries
|
||||
| otherwise = mempty
|
||||
|
||||
dateWgt :: Maybe UTCTime -> Widget
|
||||
dateWgt = maybe id (flip modal . Left ) mbLink .
|
||||
maybe (text2widget "--.--.----") (formatTimeW SelFormatDateTime)
|
||||
|
||||
|
||||
@ -426,10 +426,10 @@ cryptoidCell :: (IsDBTable m a, PathPiece cid) => cid -> DBCell m a
|
||||
cryptoidCell = addCellClass ("cryptoid" :: Text) . textCell . toPathPiece
|
||||
|
||||
lmsStatusCell :: IsDBTable m a => Bool -> Maybe (CryptoUUIDUser -> Route UniWorX) -> LmsUser -> DBCell m a
|
||||
lmsStatusCell extendedInfo Nothing lu = wgtCell $ lmsUserStatusWidget extendedInfo lu
|
||||
lmsStatusCell extendedInfo Nothing lu = wgtCell $ lmsUserStatusWidget extendedInfo Nothing lu
|
||||
lmsStatusCell extendedInfo (Just toLink) lu = cell $ do
|
||||
uuid <- liftHandler $ encrypt $ lu ^. _lmsUserUser
|
||||
modal (lmsUserStatusWidget extendedInfo lu) (Left $ SomeRoute $ toLink uuid)
|
||||
lmsUserStatusWidget extendedInfo (Just $ SomeRoute $ toLink uuid) lu
|
||||
|
||||
lmsStateCell :: IsDBTable m a => LmsState -> DBCell m a
|
||||
lmsStateCell LmsFailed = iconBoolCell False
|
||||
|
||||
@ -43,7 +43,7 @@ $else
|
||||
<dd .deflist__dd>^{formatTimeW SelFormatDateTime (lmsUserStarted lmsUsr)}
|
||||
$maybe _ <- lmsUserStatus lmsUsr
|
||||
<dt .deflist__dt>_{MsgTableLmsStatus}
|
||||
<dd .deflist__dd>^{lmsUserStatusWidget True lmsUsr}
|
||||
<dd .deflist__dd>^{lmsUserStatusWidget True Nothing lmsUsr}
|
||||
<dt .deflist__dt>_{MsgTableLmsIdent}
|
||||
<dd .deflist__dd>
|
||||
<a href=@{LmsIdentR (qualificationSchool quali) (qualificationShorthand quali) (lmsUserIdent lmsUsr)}>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user