Skip to content

Commit 1a971ad

Browse files
committed
Fancy handling of crate versions on home page
- For the Just Updated column, the newest version is displayed - For the Most Downloaded column, no version is displayed - For the New Crates column, the highest version is displayed (unchanged)
1 parent 3748278 commit 1a971ad

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<ol>
2+
{{#each crates as |crate index|}}
3+
<li>
4+
{{#link-to 'crate' crate.id class='name' data-test-crate-link=index}}
5+
<span>{{ crate.name }}</span>
6+
<div class='arrow-in-list'>
7+
{{svg-jar "right-arrow"}}
8+
</div>
9+
{{/link-to}}
10+
</li>
11+
{{/each}}
12+
</ol>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<ol>
2+
{{#each crates as |crate index|}}
3+
<li>
4+
{{#link-to 'crate' crate.id class='name' data-test-crate-link=index}}
5+
<span>{{ crate.name }} ({{ crate.newest_version }})</span>
6+
<div class='arrow-in-list'>
7+
{{svg-jar "right-arrow"}}
8+
</div>
9+
{{/link-to}}
10+
</li>
11+
{{/each}}
12+
</ol>

app/templates/index.hbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@
3838
<div id='home-crates' class='crate-lists'>
3939
<section id='new-crates' data-test-new-crates aria-busy="{{dataTask.isRunning}}">
4040
<h2>New Crates</h2>
41-
<CrateList @crates={{model.new_crates}} />
41+
<CrateListNewest @crates={{model.new_crates}} />
4242
</section>
4343
<section id='most-downloaded' data-test-most-downloaded aria-busy="{{dataTask.isRunning}}">
4444
<h2>Most Downloaded</h2>
45-
<CrateList @crates={{model.most_downloaded}} />
45+
<CrateListNameOnly @crates={{model.most_downloaded}} />
4646
</section>
4747
<section id='just-updated' data-test-just-updated aria-busy="{{dataTask.isRunning}}">
4848
<h2>Just Updated</h2>
49-
<CrateList @crates={{model.just_updated}} />
49+
<CrateListNewest @crates={{model.just_updated}} />
5050
</section>
5151
<section id='most-recently-downloaded' data-test-most-recently-downloaded aria-busy="{{dataTask.isRunning}}">
5252
<h2>Most Recent Downloads</h2>
53-
<CrateList @crates={{model.most_recently_downloaded}} />
53+
<CrateListNameOnly @crates={{model.most_recently_downloaded}} />
5454
</section>
5555
<section id='keywords' data-test-keywords aria-busy="{{dataTask.isRunning}}">
5656
<h2>Popular Keywords <LinkTo @route="keywords">(see all)</LinkTo></h2>

tests/acceptance/front-page-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module('Acceptance | front page', function(hooks) {
3838
assert.dom('[data-test-new-crates] [data-test-crate-link="0"]').hasText('Inflector (0.1.6)');
3939
assert.dom('[data-test-new-crates] [data-test-crate-link="0"]').hasAttribute('href', '/crates/Inflector');
4040

41-
assert.dom('[data-test-most-downloaded] [data-test-crate-link="0"]').hasText('serde (0.6.1)');
41+
assert.dom('[data-test-most-downloaded] [data-test-crate-link="0"]').hasText('serde');
4242
assert.dom('[data-test-most-downloaded] [data-test-crate-link="0"]').hasAttribute('href', '/crates/serde');
4343

4444
assert.dom('[data-test-just-updated] [data-test-crate-link="0"]').hasText('nanomsg (0.7.0-alpha)');

0 commit comments

Comments
 (0)