Sha256: e76e7f1648be0c94995db609373d41304daa9e1c265e893ebca14aa4e7ae7a6e

Contents?: true

Size: 1006 Bytes

Versions: 27

Compression:

Stored size: 1006 Bytes

Contents

class IuguUI.Dataset extends IuguUI.View
  layout: "iugu-ui-dataset"
  secondaryView: true

  defaults:
    itemLayout: "iugu-ui-dataset-record"
    itemTagName: "div"
    itemClassName: "record"

  initialize: ->
    super
    _.bindAll @, 'renderItems', 'addRecord'

    @collection.on 'fetch', @enableLoader, @
    @collection.on 'reset', @load, @

    @

  addRecord: (item) ->
    @els.push (
      new IuguUI.DatasetRecord
        model: item
        baseURL: @options.baseURL
        layout: @options.itemLayout
        fields: @options.fields
        tagName: @options.itemTagName
        className: @options.itemClassName
        identifier: @identifier() + "record"
        presenter: @options.recordPresenter
        parent: @
    ).render().el

  context: ->
    dataset: @collection
    options: @options

  render: ->
    super
    @renderItems()

    @

  renderItems: ->
    @els = []
    @collection.each @addRecord

    @$('.records').append @els

    @

@IuguUI.Dataset = IuguUI.Dataset

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
iugu-ux-1.0.17 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.16 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.15 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.14 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.13 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.12 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.11 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.10 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.9 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.8 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.7 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.6 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.5 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.4 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.3 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.2 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.1 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-1.0.0 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-0.9.9 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee
iugu-ux-0.9.8 vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-dataset.js.coffee