Fix sync button

This commit is contained in:
Piotr Sarnacki 2013-03-04 17:16:31 +01:00
parent 6f0678c137
commit 9ee359664c
5 changed files with 17 additions and 6 deletions

View File

@ -18,16 +18,11 @@ Travis.MainController = Em.Controller.extend()
Travis.StatsLayoutController = Em.Controller.extend()
Travis.ProfileLayoutController = Em.Controller.extend()
Travis.AuthLayoutController = Em.Controller.extend()
Travis.CurrentUserController = Em.ObjectController.extend()
Travis.AccountProfileController = Em.Controller.extend
needs: ['currentUser']
userBinding: 'controllers.currentUser'
Travis.AccountIndexController = Em.Controller.extend
needs: ['profile']
hooksBinding: 'controllers.profile.hooks'
require 'controllers/accounts'
require 'controllers/build'
require 'controllers/builds'
@ -40,3 +35,6 @@ require 'controllers/repo'
require 'controllers/running_jobs'
require 'controllers/sidebar'
require 'controllers/stats'
require 'controllers/current_user'
require 'controllers/account_index'

View File

@ -0,0 +1,7 @@
Travis.AccountIndexController = Em.Controller.extend
needs: ['profile', 'currentUser']
hooksBinding: 'controllers.profile.hooks'
userBinding: 'controllers.currentUser'
sync: ->
@get('user').sync()

View File

@ -0,0 +1,3 @@
Travis.CurrentUserController = Em.ObjectController.extend
sync: ->
@get('content').sync()

View File

@ -20,6 +20,9 @@ Travis.ProfileController = Travis.Controller.extend
account
).property('accounts.length', 'params.login')
sync: ->
@get('user').sync()
activate: (action, params) ->
@setParams(params || @get('params'))
this["view#{$.camelize(action)}"]()

View File

@ -10,7 +10,7 @@
{{else}}
<p class="message">
Last synchronized from GitHub: {{formatTime user.syncedAt}}
<a class="sync_now button" {{action sync target="user"}}>
<a class="sync_now button" {{action sync}}>
Sync now
</a>
</p>