MaterialVisible has an icon now and no more alert
This commit is contained in:
parent
99061a89c4
commit
ceace36abd
5
.vscode/tasks.json
vendored
5
.vscode/tasks.json
vendored
@ -43,6 +43,11 @@
|
|||||||
"panel": "dedicated",
|
"panel": "dedicated",
|
||||||
"showReuseMessage": false
|
"showReuseMessage": false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "yesod:lint",
|
||||||
|
"problemMatcher": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -239,7 +239,6 @@ MaterialVisibleFrom: Sichtbar für Teilnehmer ab
|
|||||||
MaterialVisibleFromTip: Ohne Datum nie sichtbar für Teilnehmer; leer lassen ist nur sinnvoll für unfertige Materialien oder zur ausschließlichen Verteilung an Korrektoren
|
MaterialVisibleFromTip: Ohne Datum nie sichtbar für Teilnehmer; leer lassen ist nur sinnvoll für unfertige Materialien oder zur ausschließlichen Verteilung an Korrektoren
|
||||||
MaterialVisibleFromEditWarning: Das Datum der Veröffentlichung liegt in der Vergangenheit und sollte nicht mehr verändert werden, da dies die Benutzer verwirren könnte.
|
MaterialVisibleFromEditWarning: Das Datum der Veröffentlichung liegt in der Vergangenheit und sollte nicht mehr verändert werden, da dies die Benutzer verwirren könnte.
|
||||||
MaterialInvisible: Dieses Material ist für Teilnehmer momentan unsichtbar!
|
MaterialInvisible: Dieses Material ist für Teilnehmer momentan unsichtbar!
|
||||||
MaterialInvisibleUntil date@Text: Dieses Material ist für Teilnehmer momentan unsichtbar bis #{date}!
|
|
||||||
MaterialFiles: Dateien
|
MaterialFiles: Dateien
|
||||||
MaterialHeading materialName@MaterialName: Material "#{materialName}"
|
MaterialHeading materialName@MaterialName: Material "#{materialName}"
|
||||||
MaterialListHeading: Materialien
|
MaterialListHeading: Materialien
|
||||||
|
|||||||
@ -222,12 +222,8 @@ getMShowR tid ssh csh mnm = do
|
|||||||
}
|
}
|
||||||
return (matEnt,fileTable')
|
return (matEnt,fileTable')
|
||||||
|
|
||||||
let matVisFro = materialVisibleFrom material
|
let matLastEdit = formatTimeW SelFormatDateTime $ materialLastEdit material
|
||||||
now <- liftIO getCurrentTime
|
let matVisibleFromMB = visibleUTCTime SelFormatDateTime <$> materialVisibleFrom material
|
||||||
materialLastEdit <- formatTime SelFormatDateTime $ materialLastEdit material
|
|
||||||
materialVisibleFrom <- traverse (formatTime SelFormatDateTime) matVisFro
|
|
||||||
when (NTop matVisFro >= NTop (Just now)) $ addMessageI Warning $
|
|
||||||
maybe MsgMaterialInvisible MsgMaterialInvisibleUntil materialVisibleFrom
|
|
||||||
|
|
||||||
let headingLong = prependCourseTitle tid ssh csh $ MsgMaterialHeading mnm
|
let headingLong = prependCourseTitle tid ssh csh $ MsgMaterialHeading mnm
|
||||||
headingShort = prependCourseTitle tid ssh csh $ SomeMessage mnm
|
headingShort = prependCourseTitle tid ssh csh $ SomeMessage mnm
|
||||||
|
|||||||
@ -80,7 +80,7 @@ serveSomeFiles archiveName source = do
|
|||||||
results <- runDB . runConduit $ source .| peekN 2
|
results <- runDB . runConduit $ source .| peekN 2
|
||||||
|
|
||||||
$logDebugS "serveSomeFiles" . tshow $ length results
|
$logDebugS "serveSomeFiles" . tshow $ length results
|
||||||
|
|
||||||
case results of
|
case results of
|
||||||
[] -> notFound
|
[] -> notFound
|
||||||
[file] -> sendThisFile file
|
[file] -> sendThisFile file
|
||||||
@ -91,9 +91,27 @@ serveSomeFiles archiveName source = do
|
|||||||
source .| produceZip ZipInfo{..} .| Conduit.map toFlushBuilder
|
source .| produceZip ZipInfo{..} .| Conduit.map toFlushBuilder
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---------
|
||||||
|
-- Simple utilities for consistent display
|
||||||
|
-- Please use these throughout, to ensure that users have a consistent experience
|
||||||
|
|
||||||
tidFromText :: Text -> Maybe TermId
|
tidFromText :: Text -> Maybe TermId
|
||||||
tidFromText = fmap TermKey . maybeRight . termFromText
|
tidFromText = fmap TermKey . maybeRight . termFromText
|
||||||
|
|
||||||
|
-- | Display given UTCTime and maybe an invisible icon if it is in the future
|
||||||
|
--
|
||||||
|
-- Also see `Handler.Utils.Table.Cells.dateTimeCellVisible` for a similar function (in case of refactoring)
|
||||||
|
visibleUTCTime :: SelDateTimeFormat -> UTCTime -> Widget
|
||||||
|
visibleUTCTime dtf t = do
|
||||||
|
let timeStampWgt = formatTimeW dtf t
|
||||||
|
now <- liftIO getCurrentTime
|
||||||
|
if now >= t
|
||||||
|
then timeStampWgt
|
||||||
|
else $(widgetFile "widgets/date-time/yet-invisible")
|
||||||
|
|
||||||
|
|
||||||
|
-- | Simple link to a known route
|
||||||
simpleLink :: Widget -> Route UniWorX -> Widget
|
simpleLink :: Widget -> Route UniWorX -> Widget
|
||||||
simpleLink lbl url = [whamlet|<a href=@{url}>^{lbl}|]
|
simpleLink lbl url = [whamlet|<a href=@{url}>^{lbl}|]
|
||||||
|
|
||||||
|
|||||||
@ -131,7 +131,9 @@ dateCell t = cell $ formatTime SelFormatDate t >>= toWidget
|
|||||||
dateTimeCell :: IsDBTable m a => UTCTime -> DBCell m a
|
dateTimeCell :: IsDBTable m a => UTCTime -> DBCell m a
|
||||||
dateTimeCell t = cell $ formatTime SelFormatDateTime t >>= toWidget
|
dateTimeCell t = cell $ formatTime SelFormatDateTime t >>= toWidget
|
||||||
|
|
||||||
-- | Show a date, and highlight date earlier than given watershed with an icon
|
-- | Show a date, and highlight date earlier than given watershed with an icon and cell class Warning
|
||||||
|
--
|
||||||
|
-- Cannot use `Handler.Utils.visibleUTCTime`, since setting the UrgencyClass must be done outside the monad, hence the watershed argument.
|
||||||
dateTimeCellVisible :: IsDBTable m a => UTCTime -> UTCTime -> DBCell m a
|
dateTimeCellVisible :: IsDBTable m a => UTCTime -> UTCTime -> DBCell m a
|
||||||
dateTimeCellVisible watershed t
|
dateTimeCellVisible watershed t
|
||||||
| watershed < t = cell $(widgetFile "widgets/date-time/yet-invisible") & addUrgencyClass
|
| watershed < t = cell $(widgetFile "widgets/date-time/yet-invisible") & addUrgencyClass
|
||||||
|
|||||||
@ -10,11 +10,11 @@ $maybe descr <- materialDescription
|
|||||||
$maybe matKind <- materialType
|
$maybe matKind <- materialType
|
||||||
<dt .deflist__dt>_{MsgMaterialType}
|
<dt .deflist__dt>_{MsgMaterialType}
|
||||||
<dd .deflist__dd>#{matKind}
|
<dd .deflist__dd>#{matKind}
|
||||||
$maybe matVisible <- materialVisibleFrom
|
$maybe matVisibleFromWgt <- matVisibleFromMB
|
||||||
<dt .deflist__dt>_{MsgVisibleFrom}
|
<dt .deflist__dt>_{MsgVisibleFrom}
|
||||||
<dd .deflist__dd>#{matVisible}
|
<dd .deflist__dd>^{matVisibleFromWgt}
|
||||||
<dt .deflist__dt>_{MsgFileModified}
|
<dt .deflist__dt>_{MsgFileModified}
|
||||||
<dd .deflist__dd>#{materialLastEdit}
|
<dd .deflist__dd>^{matLastEdit}
|
||||||
|
|
||||||
$if hasFiles
|
$if hasFiles
|
||||||
<section>
|
<section>
|
||||||
|
|||||||
Reference in New Issue
Block a user