We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f93e3f8 + 59c439a commit 27a3343Copy full SHA for 27a3343
app/router.js
@@ -23,6 +23,7 @@ Router.map(function() {
23
24
// Well-known routes
25
this.route('docs');
26
+ this.route('repo');
27
});
28
this.route('me', function() {
29
this.route('crates');
app/routes/crate/repo.js
@@ -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