Skip to content

Commit c3895e3

Browse files
authored
Merge pull request #415 from wlonk/say-rust-on-crate-page
Show the word "rust" on crate detail page
2 parents 1a2fe5e + 3007dff commit c3895e3

File tree

6 files changed

+33
-5
lines changed

6 files changed

+33
-5
lines changed

app/routes/crate.js

+17
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,22 @@ export default Ember.Route.extend({
77
return this.controllerFor('application').set('flashError', `Crate '${params.crate_id}' does not exist`);
88
}
99
});
10+
},
11+
12+
afterModel(model) {
13+
this.setHeadTags(model);
14+
},
15+
16+
setHeadTags(model) {
17+
var headTags = [{
18+
type: 'meta',
19+
tagId: 'meta-description-tag',
20+
attrs: {
21+
name: 'description',
22+
content: model.get('description') || 'A package for Rust.'
23+
}
24+
}];
25+
26+
this.set('headTags', headTags);
1027
}
1128
});

app/routes/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default Ember.Route.extend({
99
content: 'cargo is the package manager and crate host for rust'
1010
}
1111
}],
12+
1213
model() {
1314
function addCrates(store, crates) {
1415
for (var i = 0; i < crates.length; i++) {

app/styles/app.scss

+7
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ ul.dropdown {
288288
h1 { font-size: 1.5em; }
289289
}
290290

291+
h1 {
292+
span.subtitle {
293+
display: block;
294+
font-size: small;
295+
}
296+
}
297+
291298
#p404 {
292299
font-size: 120%;
293300
line-height: 3em;

app/templates/application.hbs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{title "Cargo" separator=' - ' prepend=true}}
1+
{{title "Cargo: packages for Rust" separator=' - ' prepend=true}}
22

33
<a href='https://github.com/rust-lang/crates.io' class='fork-me'>
44
<img src='/assets/forkme.png'/>
@@ -10,7 +10,10 @@
1010
height=100 width=100 />
1111
{{/link-to}}
1212
{{#link-to "index"}}
13-
<h1>CARGO</h1>
13+
<h1>
14+
CARGO
15+
<span class="subtitle">packages for Rust</span>
16+
</h1>
1417
{{/link-to}}
1518

1619
<form class='search' action='/search' {{ action "search" on="submit" }} >

tests/acceptance/front-page-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test('visiting /', function(assert) {
88

99
andThen(function() {
1010
assert.equal(currentURL(), '/');
11-
assert.equal(document.title, 'Cargo');
11+
assert.equal(document.title, 'Cargo: packages for Rust');
1212

1313
findWithAssert('a[href="/install"]');
1414
findWithAssert('a[href="/crates"]');

tests/acceptance/search-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test('searching for "rust"', function(assert) {
1313

1414
andThen(function() {
1515
assert.equal(currentURL(), '/search?q=rust');
16-
assert.equal(document.title, 'Search Results for \'rust\' - Cargo');
16+
assert.equal(document.title, 'Search Results for \'rust\' - Cargo: packages for Rust');
1717

1818
findWithAssert('a[href="/search?page=2&q=rust"]');
1919
assert.notOk(find('a[href="/search?page=3&q=rust"]')[0]);
@@ -29,7 +29,7 @@ test('searching for "rust"', function(assert) {
2929

3030
andThen(function() {
3131
assert.equal(currentURL(), '/search?page=2&q=rust');
32-
assert.equal(document.title, 'Search Results for \'rust\' - Cargo');
32+
assert.equal(document.title, 'Search Results for \'rust\' - Cargo: packages for Rust');
3333

3434
findWithAssert('a[href="/search?q=rust"]');
3535
assert.notOk(find('a[href="/search?page=3&q=rust"]')[0]);

0 commit comments

Comments
 (0)