Skip to content

Instantly share code, notes, and snippets.

@thenickcox
Created December 22, 2014 15:30
Show Gist options
  • Save thenickcox/2ef9b0de24cf2541f9d5 to your computer and use it in GitHub Desktop.
Save thenickcox/2ef9b0de24cf2541f9d5 to your computer and use it in GitHub Desktop.
App.Collections.Albums = Backbone.Collection.extend
model: App.Models.Album
url: "/users/2/albums"
featured: ->
@where(featured: true)
App.AlbumsListView = Backbone.View.extend
el: '#featured'
initialize: ->
@listenTo @collection, 'sync', @render
render: ->
for model in @collection.featured()
itemView = new App.AlbumItemView(model: model)
@$el.append itemView.render().el
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment