Forked from esmevane/0_example_views_table.coffee
Created
June 14, 2012 19:51
Revisions
-
esmevane revised this gist
Jun 14, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ class Example.Views.Table extends Backbone.View render: -> @$el.html @template() @addAll() @ @@ -18,4 +18,4 @@ class Example.Views.Table extends Backbone.View @$el.append view.render().el addAll: -> @collection.each (person) => @addOne person -
esmevane revised this gist
Jun 14, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ class Example.Views.Row extends Backbone.View template: JST['example/row'] render: -> -
esmevane revised this gist
Jun 14, 2012 . 1 changed file with 1 addition and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,10 +4,7 @@ class Example.Views.Table extends Backbone.View initialize: -> _.bindAll @, 'addOne', 'addAll' @collection.on 'add', @addOne render: -> @$el.html @template() -
esmevane created this gist
Jun 14, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ class Example.Views.Table extends Backbone.View template: JST['example/table'] initialize: -> _.bindAll @, 'addOne', 'addAll' if @collection @collection.on 'destroy', @saveChanges @collection.on 'change', @saveChanges @collection.on 'add', @addAndSave render: -> @$el.html @template() @addAll @collection, @ @ addOne: (person) -> view = new Example.Views.Row model: person @$el.append view.render().el addAll: (people) -> people.each (person) => @addOne person This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ class Example.Views.Table extends Backbone.View template: JST['example/row'] render: -> @$el.html @template @model @