Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use proper CoffeeScript in scaffold

  • Loading branch information...
commit a33fd6bb68b04cf6071f3a28d5955b21bc0526ef 1 parent 29744cc
@dnagir authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.