Skip to content

Commit 8de1d0a

Browse files
authored
Merge pull request #3596 from luis-gustavo/luis-gustavo/3413-documentation-tag-keywords-authors-page
Add “Has Documentation” Tag to Author and Keyword Views
2 parents 4e699e6 + ba48f55 commit 8de1d0a

File tree

6 files changed

+67
-3
lines changed

6 files changed

+67
-3
lines changed

Sources/App/Controllers/KeywordController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ enum KeywordController {
3131
.filter(Repository.self, \.$keywords, .custom("@>"), [keyword])
3232
.sort(\.$score, .descending)
3333
.sort(Repository.self, \.$name)
34+
.field(\.$scoreDetails)
3435
.page(page, size: pageSize)
3536
}
3637

Sources/App/Views/PackageInfo.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ extension PackageInfo {
3939
repositoryName: repoName,
4040
url: SiteURL.package(.value(repoOwner), .value(repoName), .none).relativeURL(),
4141
stars: package.repository.stars,
42-
lastActivityAt: package.repository.lastActivityAt
42+
lastActivityAt: package.repository.lastActivityAt,
43+
hasDocs: package.model.scoreDetails?.hasDocumentation ?? false
4344
)
4445
}
4546
}

Tests/AppTests/Mocks/AuthorShow+mock.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ extension AuthorShow.Model {
2626
repositoryName: "name",
2727
url: "https://example.com/owner/name.git",
2828
stars: 3,
29-
lastActivityAt: .t0
29+
lastActivityAt: .t0,
30+
hasDocs: true
3031
) }
3132
return .init(owner: "test-author", ownerName: "Test Author", packages: packages)
3233
}

Tests/AppTests/Mocks/KeywordShow+mock.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ extension KeywordShow.Model {
2626
repositoryName: "name",
2727
url: "https://example.com/owner/name.git",
2828
stars: 4,
29-
lastActivityAt: .t0
29+
lastActivityAt: .t0,
30+
hasDocs: true
3031
) }
3132
return .init(keyword: "networking", packages: packages, page: 1, hasMoreResults: false)
3233
}

Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_AuthorShow.1.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ <h4>vapor-1</h4>
105105
<li class="stars">
106106
<small>3 stars</small>
107107
</li>
108+
<li class="has-documentation">
109+
<small>Has documentation</small>
110+
</li>
108111
</ul>
109112
</a>
110113
</li>
@@ -122,6 +125,9 @@ <h4>vapor-2</h4>
122125
<li class="stars">
123126
<small>3 stars</small>
124127
</li>
128+
<li class="has-documentation">
129+
<small>Has documentation</small>
130+
</li>
125131
</ul>
126132
</a>
127133
</li>
@@ -139,6 +145,9 @@ <h4>vapor-3</h4>
139145
<li class="stars">
140146
<small>3 stars</small>
141147
</li>
148+
<li class="has-documentation">
149+
<small>Has documentation</small>
150+
</li>
142151
</ul>
143152
</a>
144153
</li>
@@ -156,6 +165,9 @@ <h4>vapor-4</h4>
156165
<li class="stars">
157166
<small>3 stars</small>
158167
</li>
168+
<li class="has-documentation">
169+
<small>Has documentation</small>
170+
</li>
159171
</ul>
160172
</a>
161173
</li>
@@ -173,6 +185,9 @@ <h4>vapor-5</h4>
173185
<li class="stars">
174186
<small>3 stars</small>
175187
</li>
188+
<li class="has-documentation">
189+
<small>Has documentation</small>
190+
</li>
176191
</ul>
177192
</a>
178193
</li>
@@ -190,6 +205,9 @@ <h4>vapor-6</h4>
190205
<li class="stars">
191206
<small>3 stars</small>
192207
</li>
208+
<li class="has-documentation">
209+
<small>Has documentation</small>
210+
</li>
193211
</ul>
194212
</a>
195213
</li>
@@ -207,6 +225,9 @@ <h4>vapor-7</h4>
207225
<li class="stars">
208226
<small>3 stars</small>
209227
</li>
228+
<li class="has-documentation">
229+
<small>Has documentation</small>
230+
</li>
210231
</ul>
211232
</a>
212233
</li>
@@ -224,6 +245,9 @@ <h4>vapor-8</h4>
224245
<li class="stars">
225246
<small>3 stars</small>
226247
</li>
248+
<li class="has-documentation">
249+
<small>Has documentation</small>
250+
</li>
227251
</ul>
228252
</a>
229253
</li>
@@ -241,6 +265,9 @@ <h4>vapor-9</h4>
241265
<li class="stars">
242266
<small>3 stars</small>
243267
</li>
268+
<li class="has-documentation">
269+
<small>Has documentation</small>
270+
</li>
244271
</ul>
245272
</a>
246273
</li>
@@ -258,6 +285,9 @@ <h4>vapor-10</h4>
258285
<li class="stars">
259286
<small>3 stars</small>
260287
</li>
288+
<li class="has-documentation">
289+
<small>Has documentation</small>
290+
</li>
261291
</ul>
262292
</a>
263293
</li>

Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_KeywordShow.1.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ <h4>Networking Package 1</h4>
9898
<li class="stars">
9999
<small>4 stars</small>
100100
</li>
101+
<li class="has-documentation">
102+
<small>Has documentation</small>
103+
</li>
101104
</ul>
102105
</a>
103106
</li>
@@ -115,6 +118,9 @@ <h4>Networking Package 2</h4>
115118
<li class="stars">
116119
<small>4 stars</small>
117120
</li>
121+
<li class="has-documentation">
122+
<small>Has documentation</small>
123+
</li>
118124
</ul>
119125
</a>
120126
</li>
@@ -132,6 +138,9 @@ <h4>Networking Package 3</h4>
132138
<li class="stars">
133139
<small>4 stars</small>
134140
</li>
141+
<li class="has-documentation">
142+
<small>Has documentation</small>
143+
</li>
135144
</ul>
136145
</a>
137146
</li>
@@ -149,6 +158,9 @@ <h4>Networking Package 4</h4>
149158
<li class="stars">
150159
<small>4 stars</small>
151160
</li>
161+
<li class="has-documentation">
162+
<small>Has documentation</small>
163+
</li>
152164
</ul>
153165
</a>
154166
</li>
@@ -166,6 +178,9 @@ <h4>Networking Package 5</h4>
166178
<li class="stars">
167179
<small>4 stars</small>
168180
</li>
181+
<li class="has-documentation">
182+
<small>Has documentation</small>
183+
</li>
169184
</ul>
170185
</a>
171186
</li>
@@ -183,6 +198,9 @@ <h4>Networking Package 6</h4>
183198
<li class="stars">
184199
<small>4 stars</small>
185200
</li>
201+
<li class="has-documentation">
202+
<small>Has documentation</small>
203+
</li>
186204
</ul>
187205
</a>
188206
</li>
@@ -200,6 +218,9 @@ <h4>Networking Package 7</h4>
200218
<li class="stars">
201219
<small>4 stars</small>
202220
</li>
221+
<li class="has-documentation">
222+
<small>Has documentation</small>
223+
</li>
203224
</ul>
204225
</a>
205226
</li>
@@ -217,6 +238,9 @@ <h4>Networking Package 8</h4>
217238
<li class="stars">
218239
<small>4 stars</small>
219240
</li>
241+
<li class="has-documentation">
242+
<small>Has documentation</small>
243+
</li>
220244
</ul>
221245
</a>
222246
</li>
@@ -234,6 +258,9 @@ <h4>Networking Package 9</h4>
234258
<li class="stars">
235259
<small>4 stars</small>
236260
</li>
261+
<li class="has-documentation">
262+
<small>Has documentation</small>
263+
</li>
237264
</ul>
238265
</a>
239266
</li>
@@ -251,6 +278,9 @@ <h4>Networking Package 10</h4>
251278
<li class="stars">
252279
<small>4 stars</small>
253280
</li>
281+
<li class="has-documentation">
282+
<small>Has documentation</small>
283+
</li>
254284
</ul>
255285
</a>
256286
</li>

0 commit comments

Comments
 (0)