Skip to content

Commit f8a8855

Browse files
committed
Auto merge of #1873 - jtescher:search-result-updated-at-time, r=carols10cents
Show crate last updated at on search results Adds the crate's last updated at time to search results on the right: <img width="901" alt="image" src="https://user-images.githubusercontent.com/175237/67069778-0ae64500-f133-11e9-95fa-f9df665aa131.png"> And with hover state to display exact date and time: <img width="937" alt="image" src="https://user-images.githubusercontent.com/175237/67069861-54cf2b00-f133-11e9-8a10-218a22aec92e.png"> Happy to move it to a different location if preferrable, reasonable alternatives could be at the end of the quick links? or under the crate title? Fixes #1597
2 parents 9454a82 + ad8839c commit f8a8855

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

app/styles/crate.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@
155155
@include display-flex;
156156
@include align-items(center);
157157
}
158+
.updated-at {
159+
padding-top: 5px;
160+
@include display-flex;
161+
@include align-items(center);
162+
163+
svg {
164+
padding: 10px;
165+
}
166+
}
158167

159168
.rev-dep-downloads {padding-left: 7px}
160169
}

app/templates/components/crate-row.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
{{svg-jar "download"}}
2222
<span class='num'><abbr title="Downloads in the last 90 days">Recent:</abbr> {{ format-num crate.recent_downloads }}</span>
2323
</div>
24+
<div class="updated-at" >
25+
{{svg-jar "latest-updates" height="32" width="32"}}
26+
<time title="Last updated: {{ crate.updated_at }}" datetime="{{ moment-format crate.updated_at 'YYYY-MM-DDTHH:mm:ssZ' }}" data-test-updated-at>
27+
{{ moment-from-now crate.updated_at }}
28+
</time>
29+
</div>
2430
</div>
2531
<div class="quick-links">
2632
<ul>

tests/acceptance/search-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ module('Acceptance | search', function(hooks) {
4545
.hasText('A Kinetic protocol library written in Rust');
4646
assert.dom('[data-test-crate-row="0"] [data-test-downloads]').hasText('All-Time: 225');
4747
assert.dom('[data-test-crate-row="0"] [data-test-badge="maintenance"]').exists();
48+
assert.dom('[data-test-crate-row="0"] [data-test-updated-at]').exists();
4849
});
4950

5051
test('searching for "rust" from query', async function(assert) {

0 commit comments

Comments
 (0)