Skip to content

Commit 94df473

Browse files
committed
Auto merge of #4379 - Turbo87:exactly, r=Turbo87
search: Show "Exact Match" as regular search result Users know what they searched for and the exact result, if there is one, will always be the first result anyways, so this special highlighting does not have a particularly big benefit. This also resolves #3910 at the same time.
2 parents 91a2cd4 + d59e59d commit 94df473

File tree

5 files changed

+1
-28
lines changed

5 files changed

+1
-28
lines changed

app/components/crate-list.hbs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
<div ...attributes>
22
{{!-- The extra div wrapper is needed for specificity issues with `margin` --}}
33
<ol local-class="list">
4-
{{#if @exactMatch}}
5-
<li local-class="row exact-match">
6-
<LinkTo @route="crate" @model={{@exactMatch}}>
7-
<h1>Exact Match</h1>
8-
</LinkTo>
9-
<CrateRow @crate={{@exactMatch}} data-test-crate-row="exact-match" />
10-
</li>
11-
{{/if}}
12-
134
{{#each @crates as |crate index|}}
145
<li local-class="row">
156
<CrateRow @crate={{crate}} data-test-crate-row={{index}} />

app/components/crate-list.module.css

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,3 @@
99
margin-bottom: 15px;
1010
}
1111
}
12-
13-
.exact-match:not(:last-child) {
14-
margin-bottom: 60px;
15-
16-
h1 {
17-
margin-top: 0;
18-
color: green
19-
}
20-
}

app/controllers/search.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,4 @@ export default class SearchController extends Controller {
6363

6464
return yield this.store.query('crate', { all_keywords, page, per_page, q, sort });
6565
}
66-
67-
get exactMatch() {
68-
return this.model.find(it => it.exact_match);
69-
}
70-
71-
get otherCrates() {
72-
return this.model.filter(it => !it.exact_match);
73-
}
7466
}

app/models/crate.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default class Crate extends Model {
1616
@attr homepage;
1717
@attr documentation;
1818
@attr repository;
19-
@attr exact_match;
2019

2120
@hasMany('versions', { async: true }) versions;
2221

app/templates/search.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
</div>
4848
</div>
4949

50-
<CrateList @exactMatch={{this.exactMatch}} @crates={{this.otherCrates}} local-class="list" />
50+
<CrateList @crates={{this.model}} local-class="list" />
5151

5252
<Pagination @pagination={{this.pagination}} />
5353
{{else}}

0 commit comments

Comments
 (0)