Redirect to getting started only from index route
Also rename renderNoOwnedRepos to redirectToGettingStarted
This commit is contained in:
parent
8c513fd7d2
commit
7ef7da5535
|
@ -16,10 +16,13 @@ Travis.ReposController = Ember.ArrayController.extend
|
|||
).observes('currentUser.id')
|
||||
|
||||
tabOrIsLoadedDidChange: (->
|
||||
@possiblyRedirectToGettingStartedPage()
|
||||
).observes('isLoaded', 'tab', 'length')
|
||||
|
||||
possiblyRedirectToGettingStartedPage: ->
|
||||
Ember.run.scheduleOnce 'routerTransitions', this, ->
|
||||
if @get('tab') == 'owned' && @get('isLoaded') && @get('length') == 0
|
||||
@container.lookup('router:main').send('renderNoOwnedRepos')
|
||||
).observes('isLoaded', 'tab', 'length')
|
||||
@container.lookup('router:main').send('redirectToGettingStarted')
|
||||
|
||||
isLoadedBinding: 'content.isLoaded'
|
||||
needs: ['currentUser', 'repo']
|
||||
|
|
|
@ -38,6 +38,9 @@ Travis.Route = Ember.Route.extend
|
|||
|
||||
Travis.ApplicationRoute = Travis.Route.extend
|
||||
actions:
|
||||
redirectToGettingStarted: ->
|
||||
# do nothing, we handle it only in index path
|
||||
|
||||
renderDefaultTemplate: ->
|
||||
@renderDefaultTemplate() if @renderDefaultTemplate
|
||||
|
||||
|
@ -49,9 +52,6 @@ Travis.ApplicationRoute = Travis.Route.extend
|
|||
else
|
||||
return true
|
||||
|
||||
renderNoOwnedRepos: ->
|
||||
@transitionTo('getting_started')
|
||||
|
||||
renderFirstSync: ->
|
||||
@renderFirstSync()
|
||||
|
||||
|
@ -116,7 +116,7 @@ Travis.GettingStartedRoute = Travis.Route.extend
|
|||
|
||||
Travis.FirstSyncRoute = Travis.Route.extend
|
||||
actions:
|
||||
renderNoOwnedRepos: (->)
|
||||
redirectToGettingStarted: ->
|
||||
# do nothing, we are showing first sync, so it's normal that there is
|
||||
# no owned repos
|
||||
|
||||
|
@ -142,12 +142,19 @@ Travis.IndexCurrentRoute = Travis.Route.extend Travis.SetupLastBuild,
|
|||
@controllerFor('repo').activate('index')
|
||||
@controllerFor('repos').addObserver('firstObject', this, 'currentRepoDidChange')
|
||||
|
||||
afterModel: ->
|
||||
@controllerFor('repos').possiblyRedirectToGettingStartedPage()
|
||||
|
||||
deactivate: ->
|
||||
@controllerFor('repos').removeObserver('firstObject', this, 'currentRepoDidChange')
|
||||
|
||||
currentRepoDidChange: ->
|
||||
@controllerFor('repo').set('repo', @controllerFor('repos').get('firstObject'))
|
||||
|
||||
actions:
|
||||
redirectToGettingStarted: ->
|
||||
@transitionTo('getting_started')
|
||||
|
||||
Travis.AbstractBuildsRoute = Travis.Route.extend
|
||||
renderTemplate: ->
|
||||
@render 'builds', into: 'repo', outlet: 'pane'
|
||||
|
|
Loading…
Reference in New Issue
Block a user