CourseParticipantsList in Hamlet ausgelagert
This commit is contained in:
parent
7e457c50fa
commit
66750f4c7d
31
PageActionPrime.txt
Normal file
31
PageActionPrime.txt
Normal file
@ -0,0 +1,31 @@
|
||||
Es s
|
||||
|
||||
Course Actions im alten UniWorX:
|
||||
- Studenten
|
||||
- Übungsgruppen
|
||||
- Übungsblätter
|
||||
- Klausuren
|
||||
- E-Mails
|
||||
- Online-Evaluation
|
||||
|
||||
CourseActions in Uni2Work:
|
||||
-1 Übungsblätter (öfter)
|
||||
[ Auch aus SheetList übernommen un hier ebenfalls angzeigt:
|
||||
-1 Aktuelles Blatt (häufig)
|
||||
-1 Letztes unzugewiesenes (häufig, nur Assistenten)
|
||||
-1 Abgaben (häufig, nur Assistenten)
|
||||
-1 Korrekturen (häufig, nur Assistenten)
|
||||
-1 Neues Blatt (häufig, nur Assistenten)
|
||||
]
|
||||
-2 Teilnehmerliste (gelegentlich, nur Assistenten)
|
||||
-2 Kurs editieren (selten, nur Assistenten)
|
||||
-2 Kurs klonen (selten, nur Assistenten)
|
||||
-2 Kurs löschen (sehr selten, nur Assistenten/Admins)
|
||||
|
||||
SheetList:
|
||||
- Aktuelles Blatt
|
||||
- Letztes unzugewiesenes
|
||||
- Abgaben
|
||||
- Korrekturen
|
||||
- Neues Blatt
|
||||
|
||||
@ -71,6 +71,7 @@ CourseEditTitle: Kurs editieren/anlegen
|
||||
CourseMembers: Teilnehmer
|
||||
CourseMembersCount num@Int64: #{display num}
|
||||
CourseMembersCountLimited num@Int64 max@Int64: #{display num}/#{display max}
|
||||
CourseMembersCountOf num@Int64 mbNum@Int64Maybe: #{display num} Anmeldungen #{maybeDisplay " von " mbNum " möglichen"}
|
||||
CourseName: Name
|
||||
CourseDescription: Beschreibung
|
||||
CourseDescriptionTip: Beliebiges HTML-Markup ist gestattet
|
||||
|
||||
@ -170,7 +170,13 @@ noneOneMoreDE num noneText singularForm pluralForm
|
||||
| num == 1 = singularForm
|
||||
| otherwise = pluralForm
|
||||
|
||||
-- Convenience Type for Messages
|
||||
type Int64Maybe = Maybe Int64 -- Yesod messages cannot deal with compound type identifiers
|
||||
|
||||
-- | Convenience function for i18n messages definitions
|
||||
maybeDisplay :: DisplayAble m => Text -> Maybe m -> Text -> Text
|
||||
maybeDisplay _ Nothing _ = mempty
|
||||
maybeDisplay before (Just x) after = before <> (display x) <> after
|
||||
|
||||
-- Messages creates type UniWorXMessage and RenderMessage UniWorX instance
|
||||
mkMessage "UniWorX" "messages/uniworx" "de"
|
||||
|
||||
@ -289,7 +289,7 @@ getCShowR tid ssh csh = do
|
||||
(regWidget, regEnctype) <- generateFormPost $ identifyForm "registerBtn" $ registerForm (isJust mRegAt) $ courseRegisterSecret course
|
||||
registrationOpen <- (==Authorized) <$> isAuthorized (CourseR tid ssh csh CRegisterR) True
|
||||
siteLayout (toWgt $ courseName course) $ do
|
||||
setTitle [shamlet| #{toPathPiece tid} - #{csh}|]
|
||||
setTitleI $ prependCourseTitle tid ssh csh (""::Text)
|
||||
$(widgetFile "course")
|
||||
|
||||
|
||||
@ -698,22 +698,25 @@ makeCourseUserTable whereClause colChoices psValidator =
|
||||
|
||||
getCUsersR :: TermId -> SchoolId -> CourseShorthand -> Handler Html
|
||||
getCUsersR tid ssh csh = do
|
||||
Entity cid course <- runDB $ getBy404 $ TermSchoolCourseShort tid ssh csh
|
||||
let heading = [whamlet|_{MsgMenuCourseMembers} #{courseName course} #{display tid}|]
|
||||
whereClause = courseIs cid
|
||||
colChoices = mconcat
|
||||
[ colUserParticipantLink tid ssh csh
|
||||
, colUserEmail
|
||||
, colUserMatriclenr
|
||||
, sortable (Just "registration") (i18nCell MsgRegisteredHeader) (dateCell . view _userTableRegistration)
|
||||
, colUserComment tid ssh csh
|
||||
]
|
||||
psValidator = def
|
||||
tableWidget <- runDB $ makeCourseUserTable whereClause colChoices psValidator
|
||||
siteLayout heading $ do
|
||||
setTitle [shamlet| #{toPathPiece tid} - #{csh}|]
|
||||
-- TODO: creat hamlet wrapper
|
||||
tableWidget
|
||||
(course, numParticipants, participantTable) <- runDB $ do
|
||||
let colChoices = mconcat
|
||||
[ colUserParticipantLink tid ssh csh
|
||||
, colUserEmail
|
||||
, colUserMatriclenr
|
||||
, sortable (Just "registration") (i18nCell MsgRegisteredHeader) (dateCell . view _userTableRegistration)
|
||||
, colUserComment tid ssh csh
|
||||
]
|
||||
psValidator = def
|
||||
Entity cid course <- getBy404 $ TermSchoolCourseShort tid ssh csh
|
||||
numParticipants <- count [CourseParticipantCourse ==. cid]
|
||||
participantTable <- makeCourseUserTable (courseIs cid) colChoices psValidator
|
||||
return (course, numParticipants, participantTable)
|
||||
let headingLong = [whamlet|_{MsgMenuCourseMembers} #{courseName course} #{display tid}|]
|
||||
headingShort = prependCourseTitle tid ssh csh MsgCourseMembers
|
||||
siteLayout headingLong $ do
|
||||
setTitleI headingShort
|
||||
|
||||
$(widgetFile "course-participants")
|
||||
|
||||
|
||||
|
||||
|
||||
@ -57,6 +57,23 @@ nameHtml displayName surname
|
||||
[] -> error "Data.Text.splitOn returned empty list in violation of specification."
|
||||
|
||||
|
||||
-- | Prefix a message with a short cours id,
|
||||
-- eg. for window title bars, etc.
|
||||
-- This function should help to make this consistent everywhere
|
||||
prependCourseTitle :: (RenderMessage UniWorX msg) =>
|
||||
TermId -> SchoolId -> CourseShorthand -> msg -> UniWorXMessages
|
||||
prependCourseTitle tid ssh csh msg = UniWorXMessages
|
||||
[ SomeMessage $ toPathPiece tid
|
||||
, SomeMessage dashText
|
||||
, SomeMessage $ toPathPiece ssh
|
||||
, SomeMessage dashText
|
||||
, SomeMessage csh
|
||||
, SomeMessage msg
|
||||
]
|
||||
where
|
||||
dashText :: Text
|
||||
dashText = "-"
|
||||
|
||||
warnTermDays :: TermId -> [Maybe UTCTime] -> DB ()
|
||||
warnTermDays tid times = do
|
||||
Term{..} <- get404 tid
|
||||
|
||||
7
templates/course-participants.hamlet
Normal file
7
templates/course-participants.hamlet
Normal file
@ -0,0 +1,7 @@
|
||||
$# Shows all participants of a course, but no homework statistics
|
||||
$# Should at some point allow email messaging
|
||||
$#
|
||||
$# participantTable : widget table
|
||||
|
||||
^{participantTable}
|
||||
_{MsgCourseMembersCountOf (fromIntegral numParticipants) (courseCapacity course)}.
|
||||
Loading…
Reference in New Issue
Block a user