Automatically redirect away from 'first_sync' after synced is finished
This commit is contained in:
parent
d2ebf4cbcf
commit
d3ded51a16
|
@ -39,7 +39,7 @@ Travis.ProfileLayoutController = Em.Controller.extend()
|
|||
Travis.AuthLayoutController = Em.Controller.extend()
|
||||
|
||||
Travis.AccountProfileController = Em.Controller.extend
|
||||
needs: ['currentUser']
|
||||
needs: ['currentUser', 'repos']
|
||||
userBinding: 'controllers.currentUser'
|
||||
|
||||
Travis.FirstSyncController = Em.Controller.extend
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
{{else}}
|
||||
<h3>Great news!</h3>
|
||||
<p>
|
||||
We've successfully synchronized your details from GitHub. Now {{#linkTo "index.current"}}go get started!{{/linkTo}}
|
||||
We've successfully synchronized your details from GitHub. We will redirect you to your profile in a few seconds.
|
||||
</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<a class="signed-out" href="#" {{action "signIn" target="Travis"}}>{{t layouts.top.github_login}}</a>
|
||||
{{/if}}
|
||||
{{#if signedIn}}
|
||||
{{#linkTo "profile.index" class="signed-in"}}<img {{bindAttr src="gravatarUrl"}}/>{{userName}}{{/linkTo}}
|
||||
{{#linkTo "profile" class="signed-in"}}<img {{bindAttr src="gravatarUrl"}}/>{{userName}}{{/linkTo}}
|
||||
{{/if}}
|
||||
{{#if signingIn}}
|
||||
<span class="signing-in">{{t layouts.top.signing_in}}</span>
|
||||
|
|
|
@ -24,6 +24,27 @@ Em.View.reopen
|
|||
Travis.GettingStartedView = Travis.View.extend
|
||||
templateName: 'no_owned_repos'
|
||||
|
||||
Travis.FirstSyncView = Travis.View.extend
|
||||
didInsertElement: ->
|
||||
this.addObserver('controller.isSyncing', this, this.isSyncingDidChange)
|
||||
|
||||
willDestroyElement: ->
|
||||
this.removeObserver('controller.isSyncing', this, this.isSyncingDidChange)
|
||||
|
||||
isSyncingDidChange: ->
|
||||
if !@get('controller.isSyncing')
|
||||
self = this
|
||||
Ember.run.later this, ->
|
||||
Travis.Repo.fetch(member: @get('controller.user.login')).then( (repos) ->
|
||||
if repos.get('length')
|
||||
self.get('controller').transitionToRoute('index.current')
|
||||
else
|
||||
self.get('controller').transitionToRoute('profile')
|
||||
).then(null, (e) ->
|
||||
console.log('There was a problem while redirecting from first sync', e)
|
||||
)
|
||||
, 5000
|
||||
|
||||
require 'views/accounts'
|
||||
require 'views/application'
|
||||
require 'views/build'
|
||||
|
|
Loading…
Reference in New Issue
Block a user