Skip to content

Commit

Permalink
Merge pull request #93 from MatsMoll/develop
Browse files Browse the repository at this point in the history
[TopicWebController] Added resources based on topic id
  • Loading branch information
MatsMoll authored Jan 15, 2021
2 parents 29d8a5b + fefdba6 commit 188069b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ default:
)
break
}

#endif
let coreVersion = ProcessInfo.processInfo.environment["KOGNITA_CORE"] ?? "2.0.0"
let pagesVersion = ProcessInfo.processInfo.environment["KOGNITA_PAGES"] ?? "2.0.0"
Expand Down
Binary file added Public/assets/images/favicon-dark.ico
Binary file not shown.
Binary file modified Public/assets/images/favicon.ico
Binary file not shown.
11 changes: 11 additions & 0 deletions Sources/App/Topic/TopicWebController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ final class TopicWebController: RouteCollection {
routes.get("creator", "subjects", Subject.parameter, "topics", Topic.parameter, "edit", use: editTopic)
routes.get("subjects", Subject.parameter, "topics", use: modifyTopics)
routes.get("subjects", Subject.parameter, "topics", "row", use: topicRow)

routes.get("topics", Topic.parameter, "resources", use: resourcesForTopic)
}

func createTopic(_ req: Request) throws -> EventLoopFuture<Response> {
Expand Down Expand Up @@ -113,6 +115,15 @@ final class TopicWebController: RouteCollection {
func topicRow(req: Request) throws -> EventLoopFuture<View> {
try Topic.Templates.Modify.TopicRow().render(with: req.query.decode(Topic.self), for: req)
}

func resourcesForTopic(on req: Request) throws -> EventLoopFuture<View> {
return try req.controllers
.resourceController
.resourcesForTopic(on: req)
.flatMap { resources in
ResourceCardList().render(with: .init(resources: resources), for: req)
}
}
}

struct SubjectSelectTaskPath: Decodable {
Expand Down

0 comments on commit 188069b

Please sign in to comment.