feat(course-events): add basic (un)subscribe routes and handler

This commit is contained in:
Sarah Vaupel 2020-11-05 16:17:24 +01:00
parent d8a61ed307
commit c984947598
7 changed files with 36 additions and 3 deletions

View File

@ -136,6 +136,10 @@ ScheduleOffsetWeekCurrent: Zu aktueller Woche springen
ScheduleOffsetWeekForwardDay: 1 Tag vorwärts
ScheduleOffsetWeekForwardWeek: 1 Woche vorwärts
ScheduleOptActions: Terminübersicht
ScheduleOptOut: Opt-Out
ScheduleOptIn: Opt-In
ScheduleReset: Standard
ScheduleTableHeadTime: Zeit
@ -1481,6 +1485,7 @@ BreadcrumbSubmission: Abgabe
BreadcrumbCourseNews: Kursnachricht
BreadcrumbCourseNewsDelete: Kursnachricht löschen
BreadcrumbCourseEventDelete: Kurstermin löschen
BreadcrumbCourseEventScheduleOpt: Kurstermin (de)abonnieren
BreadcrumbProfile: Einstellungen
BreadcrumbAllocationInfo: Ablauf einer Zentralanmeldung
BreadcrumbCourseParticipantInvitation: Einladung zum Kursteilnehmer

View File

@ -137,6 +137,10 @@ ScheduleOffsetWeekCurrent: Jump to current week
ScheduleOffsetWeekForwardDay: 1 day forward
ScheduleOffsetWeekForwardWeek: 1 week forward
ScheduleOptActions: Schedule
ScheduleOptOut: Opt out
ScheduleOptIn: Opt in
ScheduleReset: Default
ScheduleTableHeadTime: Time
@ -1482,6 +1486,7 @@ BreadcrumbSubmission: Submission
BreadcrumbCourseNews: Course news
BreadcrumbCourseNewsDelete: Delete course news
BreadcrumbCourseEventDelete: Delete course occurrence
BreadcrumbCourseEventScheduleOpt: (Un)subscribe to/from course event
BreadcrumbProfile: Settings
BreadcrumbAllocationInfo: On central allocations
BreadcrumbCourseParticipantInvitation: Invitation to be a course participant

7
routes
View File

@ -216,9 +216,10 @@
!/download/*FilePath CNFileR GET !timeANDparticipant
!/events/add CEventsNewR GET POST
/events/#CryptoUUIDCourseEvent CourseEventR:
/edit CEvEditR GET POST
/delete CEvDeleteR GET POST
/personalised-sheet-files CPersonalFilesR GET
/schedule-opt/#Bool CEvScheduleOptR GET POST !free
/edit CEvEditR GET POST
/delete CEvDeleteR GET POST
/personalised-sheet-files CPersonalFilesR GET
/subs CorrectionsR GET POST !corrector !lecturer

View File

@ -207,6 +207,7 @@ instance BearerAuthSite UniWorX => YesodBreadcrumbs UniWorX where
breadcrumb (CourseR tid ssh csh CEventsNewR) = i18nCrumb MsgMenuCourseEventNew . Just $ CourseR tid ssh csh CShowR
breadcrumb (CourseR tid ssh csh (CourseEventR _cID sRoute)) = case sRoute of
CEvScheduleOptR _ -> i18nCrumb MsgBreadcrumbCourseEventScheduleOpt . Just $ CourseR tid ssh csh CShowR
CEvEditR -> i18nCrumb MsgMenuCourseEventEdit . Just $ CourseR tid ssh csh CShowR
CEvDeleteR -> i18nCrumb MsgBreadcrumbCourseEventDelete . Just $ CourseR tid ssh csh CShowR

View File

@ -5,3 +5,4 @@ module Handler.Course.Events
import Handler.Course.Events.New as Handler.Course.Events
import Handler.Course.Events.Edit as Handler.Course.Events
import Handler.Course.Events.Delete as Handler.Course.Events
import Handler.Course.Events.Schedule as Handler.Course.Events

View File

@ -0,0 +1,10 @@
module Handler.Course.Events.Schedule
( getCEvScheduleOptR , postCEvScheduleOptR
) where
import Import
getCEvScheduleOptR, postCEvScheduleOptR :: TermId -> SchoolId -> CourseShorthand -> CryptoUUIDCourseEvent -> Bool -> Handler Html
getCEvScheduleOptR = postCEvScheduleOptR
postCEvScheduleOptR _tid _ssh _csh _ceid _opt = error "postCEvScheduleOptR: work in progress"

View File

@ -260,6 +260,9 @@ $# $if NTop (Just 0) < NTop (courseCapacity course)
_{MsgCourseEventRoom}
<th .table__th uw-hide-column-header="note" :hiddenEventNotes:.course-event-note--hidden>
_{MsgCourseEventNote}
$if is _Just mbAid
<th .table__th uw-hide-column-header="schedule-actions">
_{MsgScheduleOptActions}
$if mayCreateEvents
<th .table__th uw-hide-column-header="actions">
_{MsgCourseEventActions}
@ -279,6 +282,13 @@ $# $if NTop (Just 0) < NTop (courseCapacity course)
<td .table__td :hiddenEventNotes:.course-event-note--hidden>
<div .table__td-content>
#{courseEventNote}
$if is _Just mbAid
<td .table__td>
<div .table__td-content>
$# TODO: check for current opt-* and choose link and label accordingly
<a href=@{CEventR tid ssh csh cID (CEvScheduleOptR False)} .btn .btn-primary>
_{MsgScheduleOptOut}
$# TODO: add link to remove schedule opt-*
$if mayCreateEvents
<td .table__td>
<ul .list--inline .list--iconless .list--comma-separated>