Queue log appending if record is not loaded yet

This commit is contained in:
Piotr Sarnacki 2012-09-27 19:28:26 +02:00
parent fd6a83aab1
commit 4a16f7a142

View File

@ -2,6 +2,19 @@ require 'travis/model'
@Travis.Artifact = Travis.Model.extend
body: DS.attr('string')
init: ->
@_super.apply this, arguments
@set 'queue', Ember.A([])
append: (body) ->
@set('body', @get('body') + body)
if @get('isLoaded')
@set('body', @get('body') + body)
else
@get('queue').pushObject(body)
recordDidLoad: (->
if @get('isLoaded')
queue = @get('queue')
if queue.get('length') > 0
@append queue.toArray().join('')
).observes('isLoaded')