From 39683928ecac97c8b4b157a81fa4bc059aacce62 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel <> Date: Fri, 24 Jul 2020 20:19:34 +0200 Subject: [PATCH] refactor(course-visibility): enhance visibility info on CShowR --- src/Handler/Course/Show.hs | 2 ++ templates/course.hamlet | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Handler/Course/Show.hs b/src/Handler/Course/Show.hs index 03be86723..5e446f648 100644 --- a/src/Handler/Course/Show.hs +++ b/src/Handler/Course/Show.hs @@ -217,6 +217,8 @@ getCShowR tid ssh csh = do , all (notElem pathSeparator . view _2) fs ] hiddenEventNotes = all (\(_,CourseEvent{..}) -> is _Nothing courseEventNote) events + courseVisFrom = courseVisibleFrom course + courseVisTo = courseVisibleTo course mayCreateNews <- hasWriteAccessTo $ CourseR tid ssh csh CNewsNewR mayCreateEvents <- hasWriteAccessTo $ CourseR tid ssh csh CEventsNewR mayEditCourse <- hasWriteAccessTo $ CourseR tid ssh csh CEditR diff --git a/templates/course.hamlet b/templates/course.hamlet index da5dedc5b..e0f8e3269 100644 --- a/templates/course.hamlet +++ b/templates/course.hamlet @@ -127,16 +127,16 @@ $# $if NTop (Just 0) < NTop (courseCapacity course) $if mayEditCourse
- $if isJust (courseVisibleTo course) - _{MsgCourseVisibility} - $else + $if isJust courseVisFrom && isNothing courseVisTo _{MsgCourseVisibleFrom} + $else + _{MsgCourseVisibility}
- $maybe visFrom <- courseVisibleFrom course -

- ^{formatTimeRangeW SelFormatDateTime visFrom (courseVisibleTo course)} - $nothing - _{MsgCourseInvisible} +

+ $maybe visFrom <- courseVisFrom + ^{formatTimeRangeW SelFormatDateTime visFrom courseVisTo} + $nothing + _{MsgCourseInvisible} $maybe (Allocation{allocationName, allocationRegisterByCourse}, url) <- mAllocation'

_{MsgCourseAllocation}