feat(course-teaser): redirecting to course/
Redirecting term/<tid>/ and term/<tid>/<ssh>/ to course/ with corresponding filters.
This commit is contained in:
parent
e96e17ff9f
commit
aa20389e05
@ -270,54 +270,14 @@ getTermCurrentR = do
|
|||||||
case fromNullable termIds of
|
case fromNullable termIds of
|
||||||
Nothing -> notFound
|
Nothing -> notFound
|
||||||
(Just (maximum -> tid)) ->
|
(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 :: TermId -> SchoolId -> Handler Html
|
||||||
getTermSchoolCourseListR tid ssh = do
|
getTermSchoolCourseListR tid ssh = redirect $ (CourseListR, [("courses-term", toPathPiece tid), ("courses-schoolshort", toPathPiece ssh)])
|
||||||
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")
|
|
||||||
|
|
||||||
|
|
||||||
getTermCourseListR :: TermId -> Handler Html
|
getTermCourseListR :: TermId -> Handler Html
|
||||||
getTermCourseListR tid = do
|
getTermCourseListR tid = redirect $ (CourseListR, [("courses-term", toPathPiece tid)])
|
||||||
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")
|
|
||||||
|
|
||||||
getCShowR :: TermId -> SchoolId -> CourseShorthand -> Handler Html
|
getCShowR :: TermId -> SchoolId -> CourseShorthand -> Handler Html
|
||||||
getCShowR tid ssh csh = do
|
getCShowR tid ssh csh = do
|
||||||
|
|||||||
Reference in New Issue
Block a user