Sha256: 1c874160374bdede338d4e9e7da68c2470103f5e2f1ed620d557437b7bc86ef2

Contents?: true

Size: 547 Bytes

Versions: 3

Compression:

Stored size: 547 Bytes

Contents

<%= view_namespace %> ||= {}

class <%= view_namespace %>.IndexView extends Backbone.View
  template: JST["<%= jst 'index' %>"]

  initialize: () ->
    @collection.bind('reset', @addAll)

  addAll: () =>
    @collection.each(@addOne)

  addOne: (<%= singular_model_name %>) =>
    view = new <%= view_namespace %>.<%= singular_name.camelize %>View({model : <%= singular_model_name %>})
    @$("tbody").append(view.render().el)

  render: =>
    @$el.html(@template(<%= plural_model_name %>: @collection.toJSON() ))
    @addAll()

    return this

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
bbr-wsm-1.1.0 lib/generators/backbone/scaffold/templates/views/index_view.coffee
rails-backbone-1.2.0 lib/generators/backbone/scaffold/templates/views/index_view.coffee
railsy_backbone-0.0.5 lib/generators/backbone/scaffold/templates/views/index_view.coffee