From 04ac80a8ba07892a1210d4cc8a7a2a0b4bead7f2 Mon Sep 17 00:00:00 2001 From: SJost Date: Thu, 2 Aug 2018 16:55:49 +0200 Subject: [PATCH] CourseDescription not working properly in CourseList --- src/Foundation.hs | 8 ++++++++ src/Handler/Course.hs | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index 6931f8eb7..58414a529 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -822,6 +822,14 @@ pageActions (TermCourseListR tid) = , menuItemAccessCallback' = return True } ] +pageActions (CourseListR) = + [ PageActionPrime $ MenuItem + { menuItemLabel = "Neuen Kurs anlegen" + , menuItemIcon = Just "book" + , menuItemRoute = CourseNewR + , menuItemAccessCallback' = return True + } + ] pageActions (CourseR tid csh CShowR) = [ PageActionPrime $ MenuItem { menuItemLabel = "Kurs Editieren" diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index 4ff4676a7..cfc236176 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -38,7 +38,15 @@ type CourseTableData = DBRow (Entity Course, Int64, Bool) colCourse :: IsDBTable m a => Colonnade _ CourseTableData (DBCell m a) colCourse = sortable (Just "course") (i18nCell MsgCourse) $ \DBRow{ dbrOutput=(Entity cid Course{..}, _, _) } -> - anchorCell (CourseR courseTerm courseShorthand CShowR) [whamlet|#{display courseName}|] + anchorCell (CourseR courseTerm courseShorthand CShowR) + [whamlet|#{display courseName}|] + +colDescription :: IsDBTable m a => Colonnade _ CourseTableData (DBCell m a) +colDescription = sortable Nothing (i18nCell MsgCourseDescription) + $ \DBRow{ dbrOutput=(Entity cid Course{..}, _, _) } -> + case courseDescription of + Nothing -> cell mempty + (Just d)-> cell [whamlet|

|] colCShort :: IsDBTable m a => Colonnade _ CourseTableData (DBCell m a) colCShort = sortable (Just "cshort") (i18nCell MsgCourseShort) @@ -139,6 +147,7 @@ getCourseListR = do -- TODO: Suchfunktion für Kurse und Kürzel!!! [ colCourse , colCShort , colTerm +-- , colDescription -- does not work as intended issue #80 , maybe mempty (const colRegistered) muid ] whereClause = const $ E.val True