feat(course-visibility): add invisible icon to CShowR title
This commit is contained in:
parent
39683928ec
commit
6c0adde5db
@ -210,6 +210,8 @@ getCShowR tid ssh csh = do
|
|||||||
|
|
||||||
(Any hasExams, examTable) <- runDB . mkExamTable $ Entity cid course
|
(Any hasExams, examTable) <- runDB . mkExamTable $ Entity cid course
|
||||||
|
|
||||||
|
now <- liftIO getCurrentTime
|
||||||
|
|
||||||
let visibleNews = any (view _3) news
|
let visibleNews = any (view _3) news
|
||||||
showNewsFiles fs = and
|
showNewsFiles fs = and
|
||||||
[ not $ null fs
|
[ not $ null fs
|
||||||
@ -219,11 +221,22 @@ getCShowR tid ssh csh = do
|
|||||||
hiddenEventNotes = all (\(_,CourseEvent{..}) -> is _Nothing courseEventNote) events
|
hiddenEventNotes = all (\(_,CourseEvent{..}) -> is _Nothing courseEventNote) events
|
||||||
courseVisFrom = courseVisibleFrom course
|
courseVisFrom = courseVisibleFrom course
|
||||||
courseVisTo = courseVisibleTo 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
|
mayCreateNews <- hasWriteAccessTo $ CourseR tid ssh csh CNewsNewR
|
||||||
mayCreateEvents <- hasWriteAccessTo $ CourseR tid ssh csh CEventsNewR
|
mayCreateEvents <- hasWriteAccessTo $ CourseR tid ssh csh CEventsNewR
|
||||||
mayEditCourse <- hasWriteAccessTo $ CourseR tid ssh csh CEditR
|
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)
|
setTitleI $ prependCourseTitle tid ssh csh (""::Text)
|
||||||
$(widgetFile "course")
|
$(widgetFile "course")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user