File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ Router.map(function() {
22
22
23
23
// Well-known routes
24
24
this . route ( 'docs' ) ;
25
+ this . route ( 'repo' ) ;
25
26
} ) ;
26
27
this . route ( 'me' , function ( ) {
27
28
this . route ( 'crates' ) ;
Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments