Sha256: eca6e8a0e819a726abbe0e032c9dbfd5afaa4ee549af843b6593ac9b7d5ce919

Contents?: true

Size: 613 Bytes

Versions: 4

Compression:

Stored size: 613 Bytes

Contents

<%= view_namespace %> ||= {}

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

  initialize: () ->
    @options.<%= plural_model_name %>.bind('reset', @addAll)

  addAll: () =>
    @options.<%= plural_model_name %>.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 %>: @options.<%= plural_model_name %>.toJSON() ))
    @addAll()

    return this

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
railsy_backbone-0.0.4 lib/generators/backbone/scaffold/templates/views/index_view.coffee
railsy_backbone-0.0.3 lib/generators/backbone/scaffold/templates/views/index_view.coffee
rails-backbone-0.9.10 lib/generators/backbone/scaffold/templates/views/index_view.coffee
rails-backbone-0.9.0 lib/generators/backbone/scaffold/templates/views/index_view.coffee