Browse files

Use proper CoffeeScript in scaffold

  • Loading branch information...
1 parent 29744cc commit a33fd6bb68b04cf6071f3a28d5955b21bc0526ef @dnagir committed Aug 25, 2011
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/generators/backbone/scaffold/templates/views/index_view.coffee
View
10 lib/generators/backbone/scaffold/templates/views/index_view.coffee
@@ -4,19 +4,19 @@ class <%= view_namespace %>.IndexView extends Backbone.View
template: JST["<%= jst 'index' %>"]
initialize: () ->
- _.bindAll(this, 'addOne', 'addAll', 'render');
+ _.bindAll(this, 'addOne', 'addAll', 'render')
- @options.<%= plural_model_name %>.bind('reset', this.addAll);
+ @options.<%= plural_model_name %>.bind('reset', @addAll)
addAll: () ->
- @options.<%= plural_model_name %>.each(this.addOne)
+ @options.<%= plural_model_name %>.each(@addOne)
addOne: (<%= singular_model_name %>) ->
view = new <%= view_namespace %>.<%= singular_name.camelize %>View({model : <%= singular_model_name %>})
- this.$("tbody").append(view.render().el)
+ @$("tbody").append(view.render().el)
render: ->
- $(this.el).html(this.template(<%= plural_model_name %>: this.options.<%= plural_model_name %>.toJSON() ))
+ $(@el).html(@template(<%= plural_model_name %>: @options.<%= plural_model_name %>.toJSON() ))
@addAll()
return this

0 comments on commit a33fd6b

Please sign in to comment.