Skip to content

Instantly share code, notes, and snippets.

@mrjjwright
Created May 18, 2011 14:32
Show Gist options
  • Select an option

  • Save mrjjwright/978688 to your computer and use it in GitHub Desktop.

Select an option

Save mrjjwright/978688 to your computer and use it in GitHub Desktop.
Example CoffeeKup backbone view
template = CoffeeKup.compile ->
div class: 'section first sources', ->
div id: 'sources-overview', class: 'category', ->
a href: '/sources/overview', -> 'Overview'
div class: 'section', ->
for source in @sources
div id: "sources-#{source.uuid}", class: 'category source', ->
span class: 'searching'
a href: "/sources/#{source.uuid}", -> source.name
RB.Views.Sources = Backbone.View.extend
el: $('#sidebar')
initialize: ->
_.bindAll(this, 'render')
RB.sources.bind('refresh', @render)
render: ->
$(@el).html template context: sources: RB.sources.toJSON()
return this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment