From aa20389e05bbf683e0b998444f4b52af3e52327a Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Tue, 6 Aug 2019 18:26:51 +0200 Subject: [PATCH] feat(course-teaser): redirecting to course/ Redirecting term// and term/// to course/ with corresponding filters. --- src/Handler/Course.hs | 46 +++---------------------------------------- 1 file changed, 3 insertions(+), 43 deletions(-) diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index e6b8afeae..2c0a74755 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -270,54 +270,14 @@ getTermCurrentR = do case fromNullable termIds of Nothing -> notFound (Just (maximum -> tid)) -> - redirect $ TermCourseListR tid -- redirect avoids problematic breadcrumbs, headings, etc. + redirect $ (CourseListR, [("courses-term", toPathPiece tid)]) -- redirect avoids problematic breadcrumbs, headings, etc. getTermSchoolCourseListR :: TermId -> SchoolId -> Handler Html -getTermSchoolCourseListR tid ssh = do - void . runDB $ get404 tid -- Just ensure the term exists - School{schoolName=school} <- runDB $ get404 ssh -- Just ensure the term exists - muid <- maybeAuthId - let colonnade = widgetColonnade $ mconcat - [ dbRow - , colCShort - , colDescription - , colRegFrom - , colRegTo - , colMembers - , maybe mempty (const colRegistered) muid - ] - whereClause (course, _, _) = - course E.^. CourseTerm E.==. E.val tid - E.&&. course E.^. CourseSchool E.==. E.val ssh - validator = def - & defaultSorting [SortAscBy "cshort"] - coursesTable <- runDB $ makeCourseTable whereClause colonnade validator - defaultLayout $ do - setTitleI $ MsgTermSchoolCourseListTitle tid school - $(widgetFile "courses") +getTermSchoolCourseListR tid ssh = redirect $ (CourseListR, [("courses-term", toPathPiece tid), ("courses-schoolshort", toPathPiece ssh)]) getTermCourseListR :: TermId -> Handler Html -getTermCourseListR tid = do - void . runDB $ get404 tid -- Just ensure the term exists - muid <- maybeAuthId - let colonnade = widgetColonnade $ mconcat - [ dbRow - , colCShort - , colDescription - , colSchoolShort - , colRegFrom - , colRegTo - , colMembers - , maybe mempty (const colRegistered) muid - ] - whereClause (course, _, _) = course E.^. CourseTerm E.==. E.val tid - validator = def - & defaultSorting [SortAscBy "cshort"] - coursesTable <- runDB $ makeCourseTable whereClause colonnade validator - defaultLayout $ do - setTitleI . MsgTermCourseListTitle $ tid - $(widgetFile "courses") +getTermCourseListR tid = redirect $ (CourseListR, [("courses-term", toPathPiece tid)]) getCShowR :: TermId -> SchoolId -> CourseShorthand -> Handler Html getCShowR tid ssh csh = do