Fix some of the places still using Travis.app

This commit is contained in:
Piotr Sarnacki 2013-02-20 05:38:43 +01:00
parent bd7d2ede3a
commit cfbec29978
9 changed files with 24 additions and 21 deletions

View File

@ -3,11 +3,23 @@ require 'travis/limited_array'
Travis.ReposController = Ember.ArrayController.extend Travis.ReposController = Ember.ArrayController.extend
defaultTab: 'recent' defaultTab: 'recent'
isLoadedBinding: 'content.isLoaded' isLoadedBinding: 'content.isLoaded'
needs: ['currentUser']
currentUserBinding: 'controllers.currentUser'
init: -> init: ->
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes) Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
@_super.apply this, arguments @_super.apply this, arguments
recentRepos: (->
Travis.LimitedArray.create
content: Em.ArrayProxy.extend(Em.SortableMixin).create(
sortProperties: ['sortOrder']
content: Travis.Repo.find()
isLoadedBinding: 'content.isLoaded'
)
limit: 30
).property()
updateTimes: -> updateTimes: ->
if content = @get('content') if content = @get('content')
content.forEach (r) -> r.updateTimes() content.forEach (r) -> r.updateTimes()
@ -20,18 +32,10 @@ Travis.ReposController = Ember.ArrayController.extend
this["view#{$.camelize(tab)}"](params) this["view#{$.camelize(tab)}"](params)
viewRecent: -> viewRecent: ->
return if @get('content') @set('content', @get('recentRepos'))
content = Travis.LimitedArray.create
content: Em.ArrayProxy.extend(Em.SortableMixin).create(
sortProperties: ['sortOrder']
content: Travis.Repo.find()
isLoadedBinding: 'content.isLoaded'
)
limit: 30
@set('content', content)
viewOwned: -> viewOwned: ->
@set('content', Travis.Repo.accessibleBy(Travis.app.get('currentUser.login'))) @set('content', Travis.Repo.accessibleBy(@get('currentUser.login')))
viewSearch: (params) -> viewSearch: (params) ->
@set('content', Travis.Repo.search(params.search)) @set('content', Travis.Repo.search(params.search))

View File

@ -46,7 +46,7 @@ $.extend Travis.Pusher.prototype,
Travis.Job.find(data.job.id).clearLog() Travis.Job.find(data.job.id).clearLog()
Ember.run.next -> Ember.run.next ->
Travis.app.store.receive(event, data) Travis.store.receive(event, data)
normalize: (event, data) -> normalize: (event, data) ->
switch event switch event

View File

@ -6,6 +6,6 @@
{{else}} {{else}}
<h1>Sign in</h1> <h1>Sign in</h1>
<p> <p>
<a href="#" {{action signIn target="Travis.app"}}>Please sign in with GitHub.</a> <a href="#" {{action signIn target="Travis"}}>Please sign in with GitHub.</a>
</p> </p>
{{/if}} {{/if}}

View File

@ -18,7 +18,7 @@
</a> </a>
</div> </div>
<div id="slider" {{action toggle target="Travis.app.slider"}}> <div id="slider" {{action toggle target="Travis.slider"}}>
<div class='icon'></div>&nbsp; <div class='icon'></div>&nbsp;
</div> </div>

View File

@ -4,7 +4,7 @@
</a> </a>
</div> </div>
<div id="slider" {{action toggle target="Travis.app.slider"}}> <div id="slider" {{action toggle target="Travis.slider"}}>
<div class='icon'></div>&nbsp; <div class='icon'></div>&nbsp;
</div> </div>

View File

@ -89,7 +89,7 @@
if target.is('a') && target.attr('id') && target.attr('id').match(/^L\d+$/) if target.is('a') && target.attr('id') && target.attr('id').match(/^L\d+$/)
path = target.attr 'href' path = target.attr 'href'
Travis.app.get('router').route(path) Travis.get('router').route(path)
event.stopPropagation() event.stopPropagation()
return false return false
@ -126,7 +126,7 @@
@set 'logManager', Travis.Log.create(target: this) @set 'logManager', Travis.Log.create(target: this)
toggleTailing: -> toggleTailing: ->
Travis.app.tailing.toggle() Travis.tailing.toggle()
event.preventDefault() event.preventDefault()
didInsertElement: -> didInsertElement: ->

View File

@ -10,9 +10,9 @@
classOwned: (-> classOwned: (->
classes = [] classes = []
classes.push('active') if @get('tab') == 'owned' classes.push('active') if @get('tab') == 'owned'
classes.push('display') if Travis.app.get('currentUser') classes.push('display') if @get('controller.currentUser')
classes.join(' ') classes.join(' ')
).property('tab', 'Travis.currentUser') ).property('tab', 'controller.currentUser')
classSearch: (-> classSearch: (->
'active' if @get('tab') == 'search' 'active' if @get('tab') == 'search'

View File

@ -22,8 +22,7 @@
ReposListTabsView: Travis.View.extend ReposListTabsView: Travis.View.extend
templateName: 'repos/list/tabs' templateName: 'repos/list/tabs'
tabBinding: 'controller.tab' tabBinding: 'controller.tab'
needs: ['currentUser'] currentUserBinding: 'controller.currentUser'
currentUserBinding: 'controllers.currentUser'
activate: -> activate: ->
@get('controller').activate(event.target.name) @get('controller').activate(event.target.name)