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