Skip to content
This repository
Browse code

Merge pull request #132 from mkelley33/el-cached

Replace el selectors with cached el usage
  • Loading branch information...
commit 084bb87a93f332d96bce583609b6513fbd2b590b 2 parents a4f89d7 + 3898971
Ryan Fitzgerald authored November 21, 2012
2  lib/generators/backbone/router/templates/view.coffee
@@ -4,5 +4,5 @@ class <%= view_namespace %>.<%= @action.camelize %>View extends Backbone.View
4 4
   template: JST["<%= jst @action %>"]
5 5
 
6 6
   render: ->
7  
-    $(@el).html(@template())
  7
+    @$el.html(@template())
8 8
     return this
2  lib/generators/backbone/scaffold/templates/views/edit_view.coffee
@@ -17,7 +17,7 @@ class <%= view_namespace %>.EditView extends Backbone.View
17 17
     )
18 18
 
19 19
   render : ->
20  
-    $(@el).html(@template(@model.toJSON() ))
  20
+    @$el.html(@template(@model.toJSON() ))
21 21
 
22 22
     this.$("form").backboneLink(@model)
23 23
 
2  lib/generators/backbone/scaffold/templates/views/index_view.coffee
@@ -14,7 +14,7 @@ class <%= view_namespace %>.IndexView extends Backbone.View
14 14
     @$("tbody").append(view.render().el)
15 15
 
16 16
   render: =>
17  
-    $(@el).html(@template(<%= plural_model_name %>: @options.<%= plural_model_name %>.toJSON() ))
  17
+    @$el.html(@template(<%= plural_model_name %>: @options.<%= plural_model_name %>.toJSON() ))
18 18
     @addAll()
19 19
 
20 20
     return this
2  lib/generators/backbone/scaffold/templates/views/model_view.coffee
@@ -15,5 +15,5 @@ class <%= view_namespace %>.<%= singular_name.camelize %>View extends Backbone.V
15 15
     return false
16 16
 
17 17
   render: ->
18  
-    $(@el).html(@template(@model.toJSON() ))
  18
+    @$el.html(@template(@model.toJSON() ))
19 19
     return this
2  lib/generators/backbone/scaffold/templates/views/new_view.coffee
@@ -30,7 +30,7 @@ class <%= view_namespace %>.NewView extends Backbone.View
30 30
     )
31 31
 
32 32
   render: ->
33  
-    $(@el).html(@template(@model.toJSON() ))
  33
+    @$el.html(@template(@model.toJSON() ))
34 34
 
35 35
     this.$("form").backboneLink(@model)
36 36
 
2  lib/generators/backbone/scaffold/templates/views/show_view.coffee
@@ -4,5 +4,5 @@ class <%= view_namespace %>.ShowView extends Backbone.View
4 4
   template: JST["<%= jst 'show' %>"]
5 5
 
6 6
   render: ->
7  
-    $(@el).html(@template(@model.toJSON() ))
  7
+    @$el.html(@template(@model.toJSON() ))
8 8
     return this
2  test/dummy/app/assets/javascripts/backbone/views/posts/edit_view.js.coffee
@@ -17,7 +17,7 @@ class Dummy.Views.Posts.EditView extends Backbone.View
17 17
     )
18 18
 
19 19
   render : ->
20  
-    $(@el).html(@template(@model.toJSON() ))
  20
+    @$el.html(@template(@model.toJSON() ))
21 21
 
22 22
     this.$("form").backboneLink(@model)
23 23
 
2  test/dummy/app/assets/javascripts/backbone/views/posts/index_view.js.coffee
@@ -14,7 +14,7 @@ class Dummy.Views.Posts.IndexView extends Backbone.View
14 14
     @$("tbody").append(view.render().el)
15 15
 
16 16
   render: =>
17  
-    $(@el).html(@template(posts: @options.posts.toJSON() ))
  17
+    @$el.html(@template(posts: @options.posts.toJSON() ))
18 18
     @addAll()
19 19
 
20 20
     return this
2  test/dummy/app/assets/javascripts/backbone/views/posts/new_view.js.coffee
@@ -30,7 +30,7 @@ class Dummy.Views.Posts.NewView extends Backbone.View
30 30
     )
31 31
 
32 32
   render: ->
33  
-    $(@el).html(@template(@model.toJSON() ))
  33
+    @$el.html(@template(@model.toJSON() ))
34 34
 
35 35
     this.$("form").backboneLink(@model)
36 36
 
2  test/dummy/app/assets/javascripts/backbone/views/posts/post_view.js.coffee
@@ -15,5 +15,5 @@ class Dummy.Views.Posts.PostView extends Backbone.View
15 15
     return false
16 16
 
17 17
   render: ->
18  
-    $(@el).html(@template(@model.toJSON() ))
  18
+    @$el.html(@template(@model.toJSON() ))
19 19
     return this
2  test/dummy/app/assets/javascripts/backbone/views/posts/show_view.js.coffee
@@ -4,5 +4,5 @@ class Dummy.Views.Posts.ShowView extends Backbone.View
4 4
   template: JST["backbone/templates/posts/show"]
5 5
 
6 6
   render: ->
7  
-    $(@el).html(@template(@model.toJSON() ))
  7
+    @$el.html(@template(@model.toJSON() ))
8 8
     return this

0 notes on commit 084bb87

Please sign in to comment.
Something went wrong with that request. Please try again.