feat(course-visibility): add invisible icon to CShowR title

This commit is contained in:
Sarah Vaupel 2020-07-24 20:37:32 +02:00
parent 39683928ec
commit 6c0adde5db

View File

@ -210,6 +210,8 @@ getCShowR tid ssh csh = do
(Any hasExams, examTable) <- runDB . mkExamTable $ Entity cid course
now <- liftIO getCurrentTime
let visibleNews = any (view _3) news
showNewsFiles fs = and
[ not $ null fs
@ -219,11 +221,22 @@ getCShowR tid ssh csh = do
hiddenEventNotes = all (\(_,CourseEvent{..}) -> is _Nothing courseEventNote) events
courseVisFrom = courseVisibleFrom course
courseVisTo = courseVisibleTo course
courseIsVisible
| Just visFrom <- courseVisFrom, Just visTo <- courseVisTo = visFrom <= now && now <= visTo
| Just visFrom <- courseVisFrom = visFrom <= now
| otherwise = False
mayCreateNews <- hasWriteAccessTo $ CourseR tid ssh csh CNewsNewR
mayCreateEvents <- hasWriteAccessTo $ CourseR tid ssh csh CEventsNewR
mayEditCourse <- hasWriteAccessTo $ CourseR tid ssh csh CEditR
siteLayout (toWgt $ courseName course) $ do
let heading = [whamlet|
$newline never
^{courseName course}
$if not courseIsVisible
\ #{iconInvisible}
|]
siteLayout heading $ do
setTitleI $ prependCourseTitle tid ssh csh (""::Text)
$(widgetFile "course")