File tree 2 files changed +27
-0
lines changed
2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ Router.map(function() {
16
16
this . route ( 'download' ) ;
17
17
this . route ( 'versions' ) ;
18
18
this . route ( 'reverse_dependencies' ) ;
19
+
20
+ // Well-known routes
21
+ this . route ( 'docs' ) ;
19
22
} ) ;
20
23
this . route ( 'me' , function ( ) {
21
24
this . route ( 'crates' ) ;
Original file line number Diff line number Diff line change
1
+ import Ember from 'ember' ;
2
+ import Crate from 'cargo/models/crate' ;
3
+
4
+ export default Ember . Route . extend ( {
5
+ afterModel : function ( data ) {
6
+ var crate ;
7
+
8
+ if ( data instanceof Crate ) {
9
+ crate = data ;
10
+ } else {
11
+ crate = data . crate ;
12
+ }
13
+
14
+ var documentation = crate . get ( 'documentation' ) ;
15
+
16
+ if ( documentation ) {
17
+ window . location = documentation ;
18
+ } else {
19
+ // Redirect to the crate's main page if no documentation
20
+ // URL is found.
21
+ this . transitionTo ( 'crate' , crate ) ;
22
+ }
23
+ }
24
+ } ) ;
You can’t perform that action at this time.
0 commit comments