File tree Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -11,18 +11,17 @@ export default Ember.Route.extend({
11
11
crate = data . crate ;
12
12
}
13
13
14
- var documentation = crate . get ( 'documentation' ) ,
15
- self = this ;
14
+ var documentation = crate . get ( 'documentation' ) ;
16
15
17
- setTimeout ( function ( ) {
18
- if ( documentation ) {
19
- window . location = documentation ;
20
- } else {
21
- // Redirect to the crate's main page if no documentation
22
- // URL is found.
23
- self . transitionTo ( 'crate' , crate ) ;
24
- }
25
- } , 2500 ) ;
16
+ if ( documentation ) {
17
+ window . location = documentation ;
18
+ } else {
19
+ // Redirect to the crate's main page and show a flash error if
20
+ // no documentation is found
21
+ var message = 'Crate does not supply a documentation URL' ;
22
+ this . controllerFor ( 'application' ) . set ( 'nextFlashError' , message ) ;
23
+ this . replaceWith ( 'crate' , crate ) ;
24
+ }
26
25
27
26
this . _super ( controller , crate ) ;
28
27
} ,
Original file line number Diff line number Diff line change 4
4
</div >
5
5
6
6
<p >
7
- {{ #if documentation }}
8
- Redirecting you to <code >{{ documentation }} </code >…
9
- {{ else }}
10
- <strong >{{ name }} </strong > is missing a documentation URL, returning to the crate main page…
11
- {{ /if }}
7
+ Redirecting you to <code >{{ documentation }} </code >…
12
8
</p >
You can’t perform that action at this time.
0 commit comments