diff --git a/assets/scripts/app/controllers.coffee b/assets/scripts/app/controllers.coffee index 2276639e..85a32233 100644 --- a/assets/scripts/app/controllers.coffee +++ b/assets/scripts/app/controllers.coffee @@ -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 diff --git a/assets/scripts/app/templates/first_sync.hbs b/assets/scripts/app/templates/first_sync.hbs index ec536fda..bc3df3f5 100644 --- a/assets/scripts/app/templates/first_sync.hbs +++ b/assets/scripts/app/templates/first_sync.hbs @@ -24,7 +24,7 @@ {{else}}

Great news!

- 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.

{{/if}} diff --git a/assets/scripts/app/templates/layouts/top.hbs b/assets/scripts/app/templates/layouts/top.hbs index 1e32af2b..0c1d84fa 100644 --- a/assets/scripts/app/templates/layouts/top.hbs +++ b/assets/scripts/app/templates/layouts/top.hbs @@ -35,7 +35,7 @@ {{t layouts.top.github_login}} {{/if}} {{#if signedIn}} - {{#linkTo "profile.index" class="signed-in"}}{{userName}}{{/linkTo}} + {{#linkTo "profile" class="signed-in"}}{{userName}}{{/linkTo}} {{/if}} {{#if signingIn}} {{t layouts.top.signing_in}} diff --git a/assets/scripts/app/views.coffee b/assets/scripts/app/views.coffee index a6e32a0d..1d61aea1 100644 --- a/assets/scripts/app/views.coffee +++ b/assets/scripts/app/views.coffee @@ -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'