Skip to content

Instantly share code, notes, and snippets.

@jdkealy
Created September 7, 2011 05:42
Show Gist options
  • Save jdkealy/1199856 to your computer and use it in GitHub Desktop.
Save jdkealy/1199856 to your computer and use it in GitHub Desktop.
NewDate.Views.Profiles ||= {}
class NewDate.Views.Profiles.IndexView extends Backbone.View
template: JST["backbone/templates/profiles/index"]
‣‣‣‣
initialize: () ->
_.bindAll(this, 'addOne', 'addAll', 'render');
‣‣‣‣
@options.profiles.bind('reset', this.addAll);
‣‣‣
addAll: () ->
@options.profiles.each(this.addOne)
‣‣
addOne: (profile) ->
view = new NewDate.Views.Profiles.ProfileView({model : profile})
this.$("tbody").append(view.render().el)
‣‣‣‣‣‣‣
render: ->
$(this.el).html(this.template(profiles: this.options.profiles.toJSON() ))
@addAll()
‣‣‣‣
return this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment