Skip to content

Commit 39b4e76

Browse files
committed
Auto merge of #2155 - Zexbe:pull-request-1, r=jtgeibel
Resolves issue 2143 I made three changes to improve the experience. The homepage links go to the overview instead of a specific version I added the version next to the stats, so you can tell what they are for. I added a link back to the overview page next to the stats. On the overview page it looks like this "Stats Overview" On a specific version it looks like this "Stats Overview for 0.2.4 (see all)" Resolves issue #2143 Remaking to run job again
2 parents 5dcb80d + c7bf3fe commit 39b4e76

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

app/components/crate-list-newest.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ol>
22
{{#each @crates as |crate index|}}
33
<li>
4-
<LinkTo @route="crate.version" @models={{array crate.id crate.newest_version}} class="name" data-test-crate-link={{index}}>
4+
<LinkTo @route="crate" @model={{crate.id}} class="name" data-test-crate-link={{index}}>
55
<span>{{ crate.name }} ({{ crate.newest_version }})</span>
66
<div class='arrow-in-list'>
77
{{svg-jar "right-arrow"}}

app/templates/crate/version.hbs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,15 @@
246246
{{#unless this.currentVersion.yanked}}
247247
<div id='crate-downloads'>
248248
<div class='stats'>
249-
<h3>Stats Overview</h3>
249+
{{#if this.downloadsContext.num}}
250+
<h3 data-test-crate-stats-label>
251+
Stats Overview for {{this.downloadsContext.num}}
252+
<LinkTo @route="crate" @model={{this.crate}}>(see all)</LinkTo>
253+
</h3>
254+
255+
{{else}}
256+
<h3 data-test-crate-stats-label>Stats Overview</h3>
257+
{{/if}}
250258
<div class='stat'>
251259
<span class='num'>
252260
{{svg-jar "download"}}

tests/acceptance/crate-test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module('Acceptance | crate page', function(hooks) {
5656
await visit('/');
5757
await click('[data-test-just-updated] [data-test-crate-link="0"]');
5858

59-
assert.equal(currentURL(), '/crates/nanomsg/0.6.1');
59+
assert.equal(currentURL(), '/crates/nanomsg');
6060
assert.equal(title(), 'nanomsg - crates.io: Rust Package Registry');
6161

6262
assert.dom('[data-test-heading] [data-test-crate-name]').hasText('nanomsg');
@@ -76,6 +76,7 @@ module('Acceptance | crate page', function(hooks) {
7676

7777
assert.dom('[data-test-heading] [data-test-crate-name]').hasText('nanomsg');
7878
assert.dom('[data-test-heading] [data-test-crate-version]').hasText('0.6.1');
79+
assert.dom('[data-test-crate-stats-label]').hasText('Stats Overview');
7980
});
8081

8182
test('visiting /crates/nanomsg/', async function(assert) {
@@ -91,6 +92,7 @@ module('Acceptance | crate page', function(hooks) {
9192

9293
assert.dom('[data-test-heading] [data-test-crate-name]').hasText('nanomsg');
9394
assert.dom('[data-test-heading] [data-test-crate-version]').hasText('0.6.1');
95+
assert.dom('[data-test-crate-stats-label]').hasText('Stats Overview');
9496
});
9597

9698
test('visiting /crates/nanomsg/0.6.0', async function(assert) {
@@ -106,6 +108,7 @@ module('Acceptance | crate page', function(hooks) {
106108

107109
assert.dom('[data-test-heading] [data-test-crate-name]').hasText('nanomsg');
108110
assert.dom('[data-test-heading] [data-test-crate-version]').hasText('0.6.0');
111+
assert.dom('[data-test-crate-stats-label]').hasText('Stats Overview for 0.6.0 (see all)');
109112
});
110113

111114
test('navigating to the all versions page', async function(assert) {

tests/acceptance/front-page-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ module('Acceptance | front page', function(hooks) {
3636
assert.dom('[data-test-total-crates]').hasText('23');
3737

3838
assert.dom('[data-test-new-crates] [data-test-crate-link="0"]').hasText('Inflector (0.1.6)');
39-
assert.dom('[data-test-new-crates] [data-test-crate-link="0"]').hasAttribute('href', '/crates/Inflector/0.1.6');
39+
assert.dom('[data-test-new-crates] [data-test-crate-link="0"]').hasAttribute('href', '/crates/Inflector');
4040

4141
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.6.1)');
45-
assert.dom('[data-test-just-updated] [data-test-crate-link="0"]').hasAttribute('href', '/crates/nanomsg/0.6.1');
45+
assert.dom('[data-test-just-updated] [data-test-crate-link="0"]').hasAttribute('href', '/crates/nanomsg');
4646

4747
percySnapshot(assert);
4848
});

0 commit comments

Comments
 (0)