Skip to content

Commit

Permalink
Merge remote-tracking branch 'joliss/fat-arrow'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Fitzgerald committed Nov 27, 2011
2 parents 0196587 + 7f0bf52 commit 7842ce4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Expand Up @@ -4,18 +4,16 @@ class <%= view_namespace %>.IndexView extends Backbone.View
template: JST["<%= jst 'index' %>"]

initialize: () ->
_.bindAll(this, 'addOne', 'addAll', 'render')

@options.<%= plural_model_name %>.bind('reset', @addAll)

addAll: () ->
addAll: () =>
@options.<%= plural_model_name %>.each(@addOne)

addOne: (<%= singular_model_name %>) ->
addOne: (<%= singular_model_name %>) =>
view = new <%= view_namespace %>.<%= singular_name.camelize %>View({model : <%= singular_model_name %>})
@$("tbody").append(view.render().el)

render: ->
render: =>
$(@el).html(@template(<%= plural_model_name %>: @options.<%= plural_model_name %>.toJSON() ))
@addAll()

Expand Down
Expand Up @@ -4,18 +4,16 @@ class Dummy.Views.Posts.IndexView extends Backbone.View
template: JST["backbone/templates/posts/index"]

initialize: () ->
_.bindAll(this, 'addOne', 'addAll', 'render')

@options.posts.bind('reset', @addAll)

addAll: () ->
addAll: () =>
@options.posts.each(@addOne)

addOne: (post) ->
addOne: (post) =>
view = new Dummy.Views.Posts.PostView({model : post})
@$("tbody").append(view.render().el)

render: ->
render: =>
$(@el).html(@template(posts: @options.posts.toJSON() ))
@addAll()

Expand Down

0 comments on commit 7842ce4

Please sign in to comment.