Skip to content

Commit 27a3343

Browse files
committed
Merge remote-tracking branch 'upstream/pr/535'
2 parents f93e3f8 + 59c439a commit 27a3343

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

app/router.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Router.map(function() {
2323

2424
// Well-known routes
2525
this.route('docs');
26+
this.route('repo');
2627
});
2728
this.route('me', function() {
2829
this.route('crates');

app/routes/crate/repo.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Ember from 'ember';
2+
3+
export default Ember.Route.extend({
4+
redirect() {
5+
var crate = this.modelFor('crate');
6+
7+
var repository = crate.get('repository');
8+
if (repository) {
9+
window.location = repository;
10+
} else {
11+
// Redirect to the crate's main page and show a flash error if
12+
// no repository is found
13+
var message = 'Crate does not supply a repository URL';
14+
this.controllerFor('application').set('nextFlashError', message);
15+
this.replaceWith('crate', crate);
16+
}
17+
},
18+
});

0 commit comments

Comments
 (0)