0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00

Merge pull request #2374 from ebryn/posts-item-view

Specify `itemView` on the `each` helper rather than nesting a `view` helper
This commit is contained in:
Hannah Wolfe 2014-03-09 21:22:30 +00:00
commit 18c4d3eb77
2 changed files with 17 additions and 19 deletions

View file

@ -8,24 +8,22 @@
</header>
<section class="content-list-content">
<ol class="posts-list">
{{#each itemController="posts/post"}}
{{#view "post-item-view" tagName="li" post=this}} <!-- needed because of "active" class on li item -->
{{#link-to 'posts.post' this class="permalink" title="Edit this post"}}
<h3 class="entry-title">{{title}}</h3>
<section class="entry-meta">
<span class="status">
{{#if isDraft}}
<span class="draft">Draft</span>
{{/if}}
{{#if isPublished}}
<time datetime="{{unbound published_at}}" class="date published">
Published {{format-timeago published_at}}
</time>
{{/if}}
</span>
</section>
{{/link-to}}
{{/view}}
{{#each itemController="posts/post" itemView="post-item-view" itemTagName="li"}}
{{#link-to 'posts.post' this class="permalink" title="Edit this post"}}
<h3 class="entry-title">{{title}}</h3>
<section class="entry-meta">
<span class="status">
{{#if isDraft}}
<span class="draft">Draft</span>
{{/if}}
{{#if isPublished}}
<time datetime="{{unbound published_at}}" class="date published">
Published {{format-timeago published_at}}
</time>
{{/if}}
</span>
</section>
{{/link-to}}
{{/each}}
</ol>
</section>

View file

@ -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")
});