Skip to content

Instantly share code, notes, and snippets.

@thenickcox
Last active August 29, 2015 14:11
Show Gist options
  • Save thenickcox/89f74b8eed2c601aae96 to your computer and use it in GitHub Desktop.
Save thenickcox/89f74b8eed2c601aae96 to your computer and use it in GitHub Desktop.
App.Views.AlbumsListView = Backbone.View.extend
el: '#featured'
initialize: ->
@listenTo @collection, 'sync', @render
@on 'handlePlaceholder', @setPlaceholder, @
render: ->
for model in @collection.featured()
itemView = new App.Views.AlbumItemView(model: model, listView: this)
@$el.append itemView.render().el
setPlaceholder: ->
if @$el.children('li').length is 0 then $('.featured-albums').append('<p>No featured albums</p>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment