     @loader.loadPods()
     @progressBar.start()
   didLoad: (chunk_id, pods) ->
-    @progressBar.update(chunk_id)
+    @progressBar.update(@loader.progress())
     @pods = @pods.concat(pods)
     if @delegate && @delegate.podsDidChange
       @delegate.podsDidChange()

class PodsLoader
  delegate: null
  requests: []
  cancel: ->
    for request in @requests
      request.abort()
    @requests = []
  loadPods: ->
    @cancel()
    for chunk in gon.pods_index

# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
class @PodsProgressBar
  update: (factor) ->
    progress = factor * 100
    $('.progress-bar').css('width', progress + '%')
  start: ->
    $('.progress-container').hide().html($('.progress-tpl').html()).slideDown(1000)
