add sync to the profile (callback still does not work)
This commit is contained in:
parent
29818f70b1
commit
c1498a0c82
|
@ -11,6 +11,10 @@ require 'travis/model'
|
||||||
syncedAt: DS.attr('string')
|
syncedAt: DS.attr('string')
|
||||||
repoCount: DS.attr('number')
|
repoCount: DS.attr('number')
|
||||||
|
|
||||||
|
init: ->
|
||||||
|
@poll() if @get('isSyncing')
|
||||||
|
@._super()
|
||||||
|
|
||||||
urlGithub: (->
|
urlGithub: (->
|
||||||
"http://github.com/#{@get('login')}"
|
"http://github.com/#{@get('login')}"
|
||||||
).property()
|
).property()
|
||||||
|
@ -27,3 +31,17 @@ require 'travis/model'
|
||||||
[this].concat Travis.Account.filter().toArray()
|
[this].concat Travis.Account.filter().toArray()
|
||||||
).property()
|
).property()
|
||||||
|
|
||||||
|
sync: ->
|
||||||
|
$.post('/api/profile/sync')
|
||||||
|
@set('isSyncing', true)
|
||||||
|
@poll()
|
||||||
|
|
||||||
|
poll: ->
|
||||||
|
$.get('/api/profile', ((data) ->
|
||||||
|
if data.user.is_syncing
|
||||||
|
Ember.run.later(this, this.poll.bind(this), 3000)
|
||||||
|
else if this.get('isSyncing')
|
||||||
|
# TODO this doesn't seem to work properly
|
||||||
|
Travis.app.store.load(Travis.User, data.user)
|
||||||
|
Travis.app.store.loadMany(Travis.Account, data.accounts)
|
||||||
|
).bind(this))
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
<p class="message">
|
<p class="message">
|
||||||
Last synchronized from GitHub: {{formatTime user.syncedAt}}
|
Last synchronized from GitHub: {{formatTime user.syncedAt}}
|
||||||
|
<button class="sync_now" {{action sync target="user"}}>
|
||||||
|
Sync now
|
||||||
|
</button>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul id="hooks">
|
<ul id="hooks">
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
border: 1px solid #DDD
|
border: 1px solid #DDD
|
||||||
@include border-radius(4px)
|
@include border-radius(4px)
|
||||||
|
|
||||||
|
button.sync_now
|
||||||
|
float: right
|
||||||
|
|
||||||
.highlight
|
.highlight
|
||||||
color: #C7371A
|
color: #C7371A
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -773,6 +773,10 @@ pre#log .bg-white {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
/* line 49, /Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/profile.sass */
|
/* line 49, /Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/profile.sass */
|
||||||
|
#profile #main .message button.sync_now {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
/* line 52, /Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/profile.sass */
|
||||||
#profile #main .highlight {
|
#profile #main .highlight {
|
||||||
color: #c7371a;
|
color: #c7371a;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user