Permalink
Browse files

Only initialize main view when on that route. Otherwise each page loa…

…d means 50+ posts rendered
  • Loading branch information...
1 parent c08bc32 commit deb4a5c7efff8e151b2cb39085fed2a8239add52 @KyleAMathews committed Apr 20, 2012
Showing with 3 additions and 2 deletions.
  1. +0 −1 app/initialize.coffee
  2. +3 −1 app/routers/main_router.coffee
View
@@ -17,7 +17,6 @@ class exports.Application extends BrunchApplication
@collections.posts.fetch()
@views.main = new MainView el: $('#container')
- @views.posts = new PostsView collection: @collections.posts
@util.loadPost = loadPost
@util.clickHandler = clickHandler
@@ -1,3 +1,4 @@
+{PostsView} = require 'views/posts_view'
{PostView} = require 'views/post_view'
{PostEditView} = require 'views/post_edit_view'
{Post} = require 'models/post'
@@ -9,7 +10,8 @@ class exports.MainRouter extends Backbone.Router
'node/:id/edit': 'editPost'
home: ->
- app.views.main.show(app.views.posts)
+ postsView = new PostsView collection: app.collections.posts
+ app.views.main.show(postsView)
post: (id) ->
app.util.loadPost id, true, (post) ->

0 comments on commit deb4a5c

Please sign in to comment.