diff --git a/Sources/App/Controllers/CustomCollectionsController.swift b/Sources/App/Controllers/CustomCollectionsController.swift index a1d0e8e76..ce207a0e3 100644 --- a/Sources/App/Controllers/CustomCollectionsController.swift +++ b/Sources/App/Controllers/CustomCollectionsController.swift @@ -73,6 +73,7 @@ enum CustomCollectionsController { let model = CustomCollectionShow.Model( key: collection.key, name: collection.name, + badge: collection.badge, packages: packageInfo, page: query.page, hasMoreResults: page.hasMoreResults diff --git a/Sources/App/Views/CustomCollection/CustomCollectionShow+Model.swift b/Sources/App/Views/CustomCollection/CustomCollectionShow+Model.swift index 751bac799..c86d57998 100644 --- a/Sources/App/Views/CustomCollection/CustomCollectionShow+Model.swift +++ b/Sources/App/Views/CustomCollection/CustomCollectionShow+Model.swift @@ -16,20 +16,31 @@ extension CustomCollectionShow { struct Model { var key: String var name: String + var badge: String? var packages: [PackageInfo] var page: Int var hasMoreResults: Bool internal init(key: String, name: String, + badge: String?, packages: [PackageInfo], page: Int, hasMoreResults: Bool) { self.key = key self.name = name + self.badge = badge self.packages = packages self.page = page self.hasMoreResults = hasMoreResults } + + var fullName: String { + if let badge { + "\(badge) \(name)" + } else { + name + } + } } } diff --git a/Sources/App/Views/CustomCollection/CustomCollectionShow+View.swift b/Sources/App/Views/CustomCollection/CustomCollectionShow+View.swift index f5fae1321..2afc4a07b 100644 --- a/Sources/App/Views/CustomCollection/CustomCollectionShow+View.swift +++ b/Sources/App/Views/CustomCollection/CustomCollectionShow+View.swift @@ -38,7 +38,8 @@ enum CustomCollectionShow { override func breadcrumbs() -> [Breadcrumb] { [ Breadcrumb(title: "Home", url: SiteURL.home.relativeURL()), - Breadcrumb(title: model.name) + Breadcrumb(title: "Collections"), + Breadcrumb(title: model.fullName) ] } @@ -46,7 +47,7 @@ enum CustomCollectionShow { .group( .h2( .class("trimmed"), - .text("\(model.name) package collection") + .text("\(model.fullName) package collection") ), .p( .text("The packages in this collection are part of a custom package collection, "), diff --git a/Tests/AppTests/Mocks/CustomCollectionShow+mock.swift b/Tests/AppTests/Mocks/CustomCollectionShow+mock.swift index 7179ef43f..03a742283 100644 --- a/Tests/AppTests/Mocks/CustomCollectionShow+mock.swift +++ b/Tests/AppTests/Mocks/CustomCollectionShow+mock.swift @@ -30,6 +30,7 @@ extension CustomCollectionShow.Model { ) } return .init(key: "custom-collection", name: "Custom Collection", + badge: "BADGE", packages: packages, page: 1, hasMoreResults: false) } diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_CustomCollectionShow.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_CustomCollectionShow.1.html index 9facb284a..ee43c3329 100644 --- a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_CustomCollectionShow.1.html +++ b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_CustomCollectionShow.1.html @@ -75,14 +75,17 @@

  • - Custom Collection + Collections +
  • +
  • + BADGE Custom Collection
  • -

    Custom Collection package collection

    +

    BADGE Custom Collection package collection

    The packages in this collection are part of a custom package collection, usable in Xcode or SwiftPM. You can find out more about custom package collections and how to request one in the launch blog post.