This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
fradrive-old/templates/course.hamlet
2019-10-17 17:25:51 +02:00

251 lines
9.6 KiB
Plaintext

$newline never
<dl .deflist>
$if not (null news) || mayCreateNews
<dt .deflist__dt>
_{MsgCourseNews}
$if not visibleNews
\ #{iconInvisible}
<dd .deflist__dd>
$if not (null news)
<ul .course-news .list--iconless>
$forall (cID, CourseNews{courseNewsTitle, courseNewsSummary, courseNewsContent}, isVisible, files, lastEditText, mayEdit, mayDelete) <- news
<li .course-news-item ##{"news-" <> toPathPiece cID}>
$case (courseNewsTitle, courseNewsSummary)
$# $of (Just title, Just summary)
$# <div .div-h3 .course-news-item__title>
$# ^{modal (toWidget title) (Left (SomeRoute (CNewsR tid ssh csh cID CNShowR)))}
$# $if not isVisible
$# \ #{iconInvisible}
$# <p .course-news-item__summary>
$# #{summary}
$of (_, Just summary)
$if not isVisible
<h3 .course-news-item__title>
#{iconInvisible}
<div .div-p .course-news-item__summary>
^{modal (toWidget summary) (Left (SomeRoute (CNewsR tid ssh csh cID CNShowR)))}
$of (Just title, Nothing)
<h3 .course-news-item__title>
#{title}
$if not isVisible
\ #{iconInvisible}
<p .course-news-item__content>
#{courseNewsContent}
$of (Nothing, Nothing)
$if not isVisible
<h3 .course-news-item__title>
#{iconInvisible}
<p .course-news-item__content>
#{courseNewsContent}
$if showNewsFiles files
<ul .course-news-item__files-links .list--inline .list--comma-separated>
$forall (_, fp) <- filter (not . view _1) files
<li .course-news-item__file-link>
<a href=@{CNewsR tid ssh csh cID (CNFileR fp)}>
#{fp}
$elseif not (null files)
<p .course-news-item__files-link>
<a href=@{CNewsR tid ssh csh cID CNArchiveR}>
#{iconFileZip}
\ _{MsgCourseNewsFiles}
<p .course-news-item__last-edit>
_{MsgCourseNewsLastEdited lastEditText}
$if mayEdit || mayDelete
<ul .course-news-item__actions .list--inline .list--comma-separated>
$if mayEdit
<li>
^{modal (i18n MsgCourseNewsActionEdit) (Left (SomeRoute (CNewsR tid ssh csh cID CNEditR)))}
$if mayDelete
<li>
^{modal (i18n MsgCourseNewsActionDelete) (Left (SomeRoute (CNewsR tid ssh csh cID CNDeleteR)))}
$if mayCreateNews
<div .div-p>
^{modal (i18n MsgCourseNewsActionCreate) (Left (SomeRoute (CourseR tid ssh csh CNewsNewR)))}
$maybe descr <- courseDescription course
<dt .deflist__dt>_{MsgCourseDescription}
<dd .deflist__dd>
<div>
#{descr}
<dt .deflist__dt>_{MsgCourseSchool}
<dd .deflist__dd>
#{schoolName}
$with numlecs <- length lecturers
$if numlecs /= 0
$if numlecs > 1
<dt .deflist__dt>_{MsgLecturersFor}
$else
<dt .deflist__dt>_{MsgLecturerFor}
<dd .deflist__dd>
<ul .list--inline .list--comma-separated>
$forall lect <- lecturers
<li>^{nameEmailWidget' lect}
$with numassi <- length assistants
$if numassi /= 0
$if numassi > 1
<dt .deflist__dt>_{MsgAssistantsFor}
$else
<dt .deflist__dt>_{MsgAssistantFor}
<dd .deflist__dd>
<ul .list--inline .list--comma-separated>
$forall assi <- assistants
<li>^{nameEmailWidget' assi}
$with numtutor <- length tutors
$if numtutor /= 0
<dt .deflist__dt>_{MsgTutorsFor numtutor}
<dd .deflist__dd>
<ul .list--inline .list--comma-separated>
$forall tutor <- tutors
<li>^{nameEmailWidget' tutor}
$with numcorrector <- length correctors
$if numcorrector /= 0
<dt .deflist__dt>_{MsgCorrectorsFor numcorrector}
<dd .deflist__dd>
<ul .list--inline .list--comma-separated>
$forall corrector <- correctors
<li>^{nameEmailWidget' corrector}
$maybe link <- courseLinkExternal course
<dt .deflist__dt>_{MsgCourseHomepageExternal}
<dd .deflist__dd>
<a href=#{link} target="_blank" rel="noopener" title="_{MsgCourseHomepageExternal}">
#{iconLink}
\ #{link}
$# $if NTop (Just 0) < NTop (courseCapacity course)
<dt .deflist__dt>_{MsgCourseParticipantsHeading}
<dd .deflist__dd>
$maybe capacity <- courseCapacity course
_{MsgCourseParticipantsCountOf participants capacity}
$nothing
_{MsgCourseParticipantsCount participants}
$maybe (Allocation{allocationName, allocationRegisterByCourse}, url) <- mAllocation'
<dt .deflist__dt>_{MsgCourseAllocation}
<dd .deflist__dd>
<a href=#{url}>
#{allocationName}
$maybe regFrom <- allocationRegisterByCourse
$maybe regFrom' <- courseRegisterFrom course
$with regFrom'' <- max regFrom regFrom'
$if NTop (Just regFrom'') <= NTop (courseRegisterTo course)
<dt .deflist__dt>_{MsgCourseDirectRegistrationInterval}
<dd .deflist__dd>
<p>
^{formatTimeRangeW SelFormatDateTime regFrom'' (courseRegisterTo course)}
$maybe dereg <- mDereg
<p .emph>
_{MsgCourseDeregisterUntil dereg}
$nothing
$maybe regFrom <- courseRegisterFrom course
<dt .deflist__dt>_{MsgCourseRegistrationInterval}
<dd .deflist__dd>
<p>
^{formatTimeRangeW SelFormatDateTime regFrom (courseRegisterTo course)}
$maybe dereg <- mDereg
<p .emph>
_{MsgCourseDeregisterUntil dereg}
$maybe aInst <- courseApplicationsInstructions course
<dt .deflist__dt>
$if courseApplicationsRequired course
_{MsgCourseApplicationInstructionsApplication}
$else
_{MsgCourseApplicationInstructionsRegistration}
<dd .deflist__dd>
<div>
#{aInst}
$if hasApplicationTemplate
<p>
<a href=@{CourseR tid ssh csh CRegisterTemplateR}>
#{iconRegisterTemplate} #
$if courseApplicationsRequired course
_{MsgCourseApplicationTemplateApplication}
$else
_{MsgCourseApplicationTemplateRegistration}
$if registrationOpen || isJust registration
<dt .deflist__dt>
_{MsgCourseRegistration}
<dd .deflist__dd>
<div .course__registration>
$if registrationOpen
$# regForm is defined through templates/widgets/registerForm
^{regForm}
$if isJust mApplication && courseApplicationsRequired course
<p>
_{MsgCourseApplicationDeleteToEdit}
$else
$if isJust registration
<p>
_{MsgCourseRegistrationDeleteToEdit}
$maybe CourseParticipant{courseParticipantRegistration} <- registration
_{MsgRegisteredSince}
\ ^{formatTimeW SelFormatDateTime courseParticipantRegistration}
$nothing
_{MsgNotRegistered}
<dt .deflist__dt>
_{MsgCourseMaterial}
<dd .deflist__dd>
$if courseMaterialFree course
_{MsgCourseMaterialFree}
$else
_{MsgCourseMaterialNotFree}
$if hasExams
<dt .deflist__dt>_{MsgCourseExams}
<dd .deflist__dd>
^{examTable}
$if not (null events) || mayCreateEvents
<dt .deflist__dt>_{MsgCourseEvents}
<dd .deflist__dd>
<div .scrolltable .scrolltable--bordered>
<table .table .table--striped .table--hover>
<thead>
<tr .table__row .table__row--head>
<th .table__th>
_{MsgCourseEventType}
<th .table__th>
_{MsgCourseEventTime}
<th .table__th>
_{MsgCourseEventRoom}
$if mayCreateEvents
<th .table__th>
_{MsgCourseEventActions}
\ #{iconInvisible}
<tbody>
$forall (cID, CourseEvent{courseEventType, courseEventTime, courseEventRoom}) <- events
<tr .table__row ##{"event-" <> toPathPiece cID}>
<td .table__td>
<div .table__td-content>
#{courseEventType}
<td .table__td>
<div .table__td-content>
^{occurrencesWidget courseEventTime}
<td .table__td>
<div .table__td-content>
#{courseEventRoom}
$if mayCreateEvents
<td .table__td>
<ul .list--inline .list--iconless .list--comma-separated>
<li>
^{modal (i18n MsgCourseEventsActionEdit) (Left (SomeRoute (CEventR tid ssh csh cID CEvEditR)))}
<li>
^{modal (i18n MsgCourseEventsActionDelete) (Left (SomeRoute (CEventR tid ssh csh cID CEvDeleteR)))}
$if mayCreateEvents
<tfoot>
<tr .table__row .table__row--foot>
<td>
<td>
<td>
<td .table__td>
<div .table__td-content>
^{modal (i18n MsgCourseEventsActionCreate) (Left (SomeRoute (CourseR tid ssh csh CEventsNewR)))}
$if hasTutorials
<dt .deflist__dt>_{MsgCourseTutorials}
<dd .deflist__dd>
^{tutorialTable}