Sha256: b3c7dd2895422941b37ec6bc29791711af98b9dfa7341adc310ac0950b57af39

Contents?: true

Size: 1.4 KB

Versions: 7

Compression:

Stored size: 1.4 KB

Contents

# Collection Loader View is a simple modal view
# You can provide your own template for the collection loader modal
# if you want to. Default implementation uses twitter bootstrap modal and
# progress bar (http://twitter.github.com/bootstrap/). You template
# should contain `progress`, `bar` and `message` classes
loaderView = Luca.register        "Luca.components.CollectionLoaderView"
loaderView.extends                "Luca.View"

loaderView.defines
  className: 'luca-ui-collection-loader-view'

  template: "components/collection_loader_view"

  initialize: (@options={})->
    Luca.components.Template::initialize.apply @,arguments

    @container ||= $('body')
    @manager   ||= Luca.CollectionManager.get()

    @setupBindings()

  modalContainer: ()->
    $("#progress-modal", @el)

  setupBindings: ()->
    @manager.bind "collection_loaded", (name)=>
      loaded   = @manager.loadedCollectionsCount()
      total    = @manager.totalCollectionsCount()
      progress = parseInt((loaded / total) * 100)
      collectionName = _.string.titleize( _.string.humanize( name ) )

      @modalContainer().find('.progress .bar').attr("style", "width: #{progress}%;")
      @modalContainer().find('.message').html("Loaded #{ collectionName }...")

    @manager.bind "all_collections_loaded", ()=>
      @modalContainer().find('.message').html("All done!")
      _.delay ()=>
        @modalContainer().modal('hide')
      , 400

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
luca-0.9.91 app/assets/javascripts/luca/components/collection_loader_view.coffee
luca-0.9.9 app/assets/javascripts/luca/components/collection_loader_view.coffee
luca-0.9.899 app/assets/javascripts/luca/components/collection_loader_view.coffee
luca-0.9.89 app/assets/javascripts/luca/components/collection_loader_view.coffee
luca-0.9.8 app/assets/javascripts/luca/components/collection_loader_view.coffee
luca-0.9.76 src/components/collection_loader_view.coffee
luca-0.9.7 src/components/collection_loader_view.coffee