From c52a9e83eaff5cc531c627b0f03ba16b057204e4 Mon Sep 17 00:00:00 2001 From: Erik Bryn Date: Sun, 9 Mar 2014 14:20:05 -0700 Subject: [PATCH] Specify `itemView` on the `each` helper rather than nesting a `view` helper. This avoids the creation of two views per row, which will make a big difference for large blogs. --- core/client/templates/posts.hbs | 34 ++++++++++++++--------------- core/client/views/post-item-view.js | 2 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/core/client/templates/posts.hbs b/core/client/templates/posts.hbs index e74421c3fd..ee8bf8e370 100644 --- a/core/client/templates/posts.hbs +++ b/core/client/templates/posts.hbs @@ -8,24 +8,22 @@
    - {{#each itemController="posts/post"}} - {{#view "post-item-view" tagName="li" post=this}} - {{#link-to 'posts.post' this class="permalink" title="Edit this post"}} -

    {{title}}

    - - {{/link-to}} - {{/view}} + {{#each itemController="posts/post" itemView="post-item-view" itemTagName="li"}} + {{#link-to 'posts.post' this class="permalink" title="Edit this post"}} +

    {{title}}

    + + {{/link-to}} {{/each}}
diff --git a/core/client/views/post-item-view.js b/core/client/views/post-item-view.js index 5e44b3cd02..5bb22846ca 100644 --- a/core/client/views/post-item-view.js +++ b/core/client/views/post-item-view.js @@ -2,7 +2,7 @@ import itemView from 'ghost/views/item-view'; var PostItemView = itemView.extend({ openEditor: function () { - this.get('controller').send('openEditor', this.get('post')); // send action to handle transition to editor route + this.get('controller').send('openEditor', this.get('context')); // send action to handle transition to editor route }.on("doubleClick") });