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
|
CourseMembers: Teilnehmer
|
||||||
CourseMembersCount num@Int64: #{display num}
|
CourseMembersCount num@Int64: #{display num}
|
||||||
CourseMembersCountLimited num@Int64 max@Int64: #{display num}/#{display max}
|
CourseMembersCountLimited num@Int64 max@Int64: #{display num}/#{display max}
|
||||||
|
CourseMembersCountOf num@Int64 mbNum@Int64Maybe: #{display num} Anmeldungen #{maybeDisplay " von " mbNum " möglichen"}
|
||||||
CourseName: Name
|
CourseName: Name
|
||||||
CourseDescription: Beschreibung
|
CourseDescription: Beschreibung
|
||||||
CourseDescriptionTip: Beliebiges HTML-Markup ist gestattet
|
CourseDescriptionTip: Beliebiges HTML-Markup ist gestattet
|
||||||
|
|||||||
@ -170,7 +170,13 @@ noneOneMoreDE num noneText singularForm pluralForm
|
|||||||
| num == 1 = singularForm
|
| num == 1 = singularForm
|
||||||
| otherwise = pluralForm
|
| 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
|
-- Messages creates type UniWorXMessage and RenderMessage UniWorX instance
|
||||||
mkMessage "UniWorX" "messages/uniworx" "de"
|
mkMessage "UniWorX" "messages/uniworx" "de"
|
||||||
|
|||||||
@ -289,7 +289,7 @@ getCShowR tid ssh csh = do
|
|||||||
(regWidget, regEnctype) <- generateFormPost $ identifyForm "registerBtn" $ registerForm (isJust mRegAt) $ courseRegisterSecret course
|
(regWidget, regEnctype) <- generateFormPost $ identifyForm "registerBtn" $ registerForm (isJust mRegAt) $ courseRegisterSecret course
|
||||||
registrationOpen <- (==Authorized) <$> isAuthorized (CourseR tid ssh csh CRegisterR) True
|
registrationOpen <- (==Authorized) <$> isAuthorized (CourseR tid ssh csh CRegisterR) True
|
||||||
siteLayout (toWgt $ courseName course) $ do
|
siteLayout (toWgt $ courseName course) $ do
|
||||||
setTitle [shamlet| #{toPathPiece tid} - #{csh}|]
|
setTitleI $ prependCourseTitle tid ssh csh (""::Text)
|
||||||
$(widgetFile "course")
|
$(widgetFile "course")
|
||||||
|
|
||||||
|
|
||||||
@ -698,22 +698,25 @@ makeCourseUserTable whereClause colChoices psValidator =
|
|||||||
|
|
||||||
getCUsersR :: TermId -> SchoolId -> CourseShorthand -> Handler Html
|
getCUsersR :: TermId -> SchoolId -> CourseShorthand -> Handler Html
|
||||||
getCUsersR tid ssh csh = do
|
getCUsersR tid ssh csh = do
|
||||||
Entity cid course <- runDB $ getBy404 $ TermSchoolCourseShort tid ssh csh
|
(course, numParticipants, participantTable) <- runDB $ do
|
||||||
let heading = [whamlet|_{MsgMenuCourseMembers} #{courseName course} #{display tid}|]
|
let colChoices = mconcat
|
||||||
whereClause = courseIs cid
|
[ colUserParticipantLink tid ssh csh
|
||||||
colChoices = mconcat
|
, colUserEmail
|
||||||
[ colUserParticipantLink tid ssh csh
|
, colUserMatriclenr
|
||||||
, colUserEmail
|
, sortable (Just "registration") (i18nCell MsgRegisteredHeader) (dateCell . view _userTableRegistration)
|
||||||
, colUserMatriclenr
|
, colUserComment tid ssh csh
|
||||||
, sortable (Just "registration") (i18nCell MsgRegisteredHeader) (dateCell . view _userTableRegistration)
|
]
|
||||||
, colUserComment tid ssh csh
|
psValidator = def
|
||||||
]
|
Entity cid course <- getBy404 $ TermSchoolCourseShort tid ssh csh
|
||||||
psValidator = def
|
numParticipants <- count [CourseParticipantCourse ==. cid]
|
||||||
tableWidget <- runDB $ makeCourseUserTable whereClause colChoices psValidator
|
participantTable <- makeCourseUserTable (courseIs cid) colChoices psValidator
|
||||||
siteLayout heading $ do
|
return (course, numParticipants, participantTable)
|
||||||
setTitle [shamlet| #{toPathPiece tid} - #{csh}|]
|
let headingLong = [whamlet|_{MsgMenuCourseMembers} #{courseName course} #{display tid}|]
|
||||||
-- TODO: creat hamlet wrapper
|
headingShort = prependCourseTitle tid ssh csh MsgCourseMembers
|
||||||
tableWidget
|
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."
|
[] -> 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 :: TermId -> [Maybe UTCTime] -> DB ()
|
||||||
warnTermDays tid times = do
|
warnTermDays tid times = do
|
||||||
Term{..} <- get404 tid
|
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)}.
|
||||||
Reference in New Issue
Block a user