Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/App/Controllers/CustomCollectionsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ enum CustomCollectionShow {
override func breadcrumbs() -> [Breadcrumb] {
[
Breadcrumb(title: "Home", url: SiteURL.home.relativeURL()),
Breadcrumb(title: model.name)
Breadcrumb(title: "Collections"),
Breadcrumb(title: model.fullName)
]
}

override func content() -> Node<HTML.BodyContext> {
.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, "),
Expand Down
1 change: 1 addition & 0 deletions Tests/AppTests/Mocks/CustomCollectionShow+mock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extension CustomCollectionShow.Model {
) }
return .init(key: "custom-collection",
name: "Custom Collection",
badge: "BADGE",
packages: packages, page: 1,
hasMoreResults: false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,17 @@ <h1>
</a>
</li>
<li>
<span>Custom Collection</span>
<span>Collections</span>
</li>
<li>
<span>BADGE Custom Collection</span>
</li>
</ul>
</div>
</nav>
<main>
<div class="inner">
<h2 class="trimmed">Custom Collection package collection</h2>
<h2 class="trimmed">BADGE Custom Collection package collection</h2>
<p>The packages in this collection are part of a custom package collection,
<a href="/package-collections">usable in Xcode or SwiftPM</a>. You can find out more about custom package collections and how to request one in the
<a href="/blog/introducing-custom-package-collections">launch blog post</a>.
Expand Down
Loading