diff --git a/src/Handler/Course/Show.hs b/src/Handler/Course/Show.hs index 5e446f648..68012e885 100644 --- a/src/Handler/Course/Show.hs +++ b/src/Handler/Course/Show.hs @@ -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")