Move afterSignIn to auth Route

If we keep it only on states lower than root and afterSignIn is sent
when app is still in root.loading (which is often the case as we need to
wait for repository deserialization), it will try to find afterSignIn on
root.
This commit is contained in:
Piotr Sarnacki 2012-10-18 03:28:26 +02:00
parent d4404b201c
commit cb76de3718
7 changed files with 1616 additions and 1618 deletions

View File

@ -148,12 +148,6 @@ Travis.Router = Ember.Router.extend
needsAuth: (path) ->
path.indexOf('/profile') == 0
afterSignIn: ->
path = sessionStorage.getItem('travis.after_signin_path')
sessionStorage.removeItem('travis.after_signin_path')
@transitionTo('root')
@route(path || '/')
afterSignOut: ->
@authorize('/')
@ -174,6 +168,7 @@ Travis.Router = Ember.Router.extend
root: Ember.Route.extend
route: '/'
loading: Ember.State.extend()
afterSignIn: (-> )
auth: Ember.Route.extend
route: '/auth'
@ -183,9 +178,14 @@ Travis.Router = Ember.Router.extend
router.get('authLayoutController').connectOutlet('top', 'top')
router.get('authLayoutController').connectOutlet('main', 'signin')
afterSignIn: (router) ->
path = sessionStorage.getItem('travis.after_signin_path')
sessionStorage.removeItem('travis.after_signin_path')
router.transitionTo('root')
router.route(path || '/')
stats: Ember.Route.extend
route: '/stats'
afterSignIn: (-> )
connectOutlets: (router) ->
router.get('applicationController').connectOutlet 'statsLayout'
$('body').attr('id', 'stats')
@ -194,7 +194,6 @@ Travis.Router = Ember.Router.extend
profile: Ember.Route.extend
initialState: 'index'
afterSignIn: (-> )
route: '/profile'
connectOutlets: (router) ->
@ -261,7 +260,6 @@ Travis.Router = Ember.Router.extend
home: Ember.Route.extend
route: '/'
afterSignIn: (-> )
connectOutlets: (router) ->
router.get('applicationController').connectOutlet 'homeLayout'
$('body').attr('id', 'home')

View File

@ -9,5 +9,3 @@
<a href="#" {{action signIn target="Travis.app"}}>Please sign in with GitHub.</a>
</p>
{{/if}}

View File

@ -3,6 +3,7 @@
#auth
#page
display: block
min-height: 500px
#main
top: 200px

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
d437e819
92c2db04