refactor(schedule): enhance course schedule opt toggle
This commit is contained in:
parent
a4a26afa7a
commit
4a726f09fb
@ -302,6 +302,13 @@ getCShowR tid ssh csh = do
|
||||
mayCreateEvents <- hasWriteAccessTo $ CourseR tid ssh csh CEventsNewR
|
||||
mayEdit <- hasWriteAccessTo $ CourseR tid ssh csh CEditR
|
||||
|
||||
let courseScheduleOptToggleValue User{userScheduleOccurrenceDisplayDefault} = maybe
|
||||
( userScheduleOccurrenceDisplayDefault
|
||||
&& ( is _Just registration )
|
||||
)
|
||||
(courseScheduleOptOpt . entityVal)
|
||||
mCourseScheduleOpt
|
||||
|
||||
let heading = [whamlet|
|
||||
$newline never
|
||||
^{courseName course}
|
||||
|
||||
@ -340,12 +340,12 @@ $# $if NTop (Just 0) < NTop (courseCapacity course)
|
||||
<dd .deflist__dd>
|
||||
^{tutorialTable}
|
||||
|
||||
$maybe (_, User{userScheduleOccurrenceDisplayDefault}) <- mbAuth
|
||||
$maybe (_, user) <- mbAuth
|
||||
<dt .deflist__dt>
|
||||
_{MsgScheduleOptActions}
|
||||
<dd .deflist__dd>
|
||||
<a .btn .btn-primary href=@{CourseR tid ssh csh (CScheduleOptSetR (not (maybe ((is _Just registration) && userScheduleOccurrenceDisplayDefault) (courseScheduleOptOpt . entityVal) mCourseScheduleOpt)))}>
|
||||
_{bool MsgCourseScheduleOptIn MsgCourseScheduleOptOut (maybe ((is _Just registration) && userScheduleOccurrenceDisplayDefault) (courseScheduleOptOpt . entityVal) mCourseScheduleOpt)}
|
||||
<a .btn .btn-primary href=@{CourseR tid ssh csh (CScheduleOptSetR (not (courseScheduleOptToggleValue user)))}>
|
||||
_{bool MsgCourseScheduleOptIn MsgCourseScheduleOptOut (courseScheduleOptToggleValue user)}
|
||||
$if is _Just mCourseScheduleOpt
|
||||
<a .btn .btn-primary href=@{CourseR tid ssh csh CScheduleOptDelR}>
|
||||
_{MsgCourseScheduleOptDelete}
|
||||
|
||||
Reference in New Issue
Block a user