restore isLoaded for repos controller

This commit is contained in:
Sven Fuchs 2012-11-10 04:21:49 +01:00
parent 38e8a2a8e1
commit d94b001e81
4 changed files with 13 additions and 2 deletions

View File

@ -3,6 +3,7 @@ require 'travis/limited_array'
Travis.ReposController = Ember.ArrayController.extend
defaultTab: 'recent'
sortProperties: ['sortOrder']
isLoadedBinding: 'content.isLoaded'
init: ->
@activate(@defaultTab)
@ -22,8 +23,8 @@ Travis.ReposController = Ember.ArrayController.extend
content = Travis.LimitedArray.create
content: Travis.Repo.find()
limit: 30
@set('content', content)
# @set('content', Travis.Repo.find())
viewOwned: ->
@set('content', Travis.Repo.accessibleBy(Travis.app.get('currentUser.login')))

View File

@ -28,6 +28,12 @@ Travis.Store = DS.Store.extend
result
# TODO use isUpdating once we've upgraded ember-data
loadMany: (type, ids, hashes) ->
result = @_super.apply this, arguments
array.set('isLoaded', true) for array in @typeMapFor(type).recordArrays
result
merge: (type, id, hash) ->
if hash == undefined
hash = id

View File

@ -9,6 +9,10 @@
'loading' unless @get('repo.isLoaded')
).property('repo.isLoaded')
isEmpty: (->
@get('repos.isLoaded') && @get('repos.length') == 0
).property('repos.length')
urlGithub: (->
Travis.Urls.githubRepo(@get('repo.slug'))
).property('repo.slug'),

View File

@ -1,5 +1,6 @@
Travis.LimitedArray = Em.ArrayProxy.extend
limit: 10
isLoadedBinding: 'content.isLoaded'
init: ->
@_super.apply this, arguments
@ -11,7 +12,6 @@ Travis.LimitedArray = Em.ArrayProxy.extend
contentArrayDidChange: (array, index, removedCount, addedCount) ->
@_super.apply this, arguments
if addedCount > 0
addedObjects = array.slice(index, index + addedCount)
arrangedContent = @get('arrangedContent')