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> </header>
<section class="content-list-content"> <section class="content-list-content">
<ol class="posts-list"> <ol class="posts-list">
{{#each itemController="posts/post"}} {{#each itemController="posts/post" itemView="post-item-view" itemTagName="li"}}
{{#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"}}
{{#link-to 'posts.post' this class="permalink" title="Edit this post"}} <h3 class="entry-title">{{title}}</h3>
<h3 class="entry-title">{{title}}</h3> <section class="entry-meta">
<section class="entry-meta"> <span class="status">
<span class="status"> {{#if isDraft}}
{{#if isDraft}} <span class="draft">Draft</span>
<span class="draft">Draft</span> {{/if}}
{{/if}} {{#if isPublished}}
{{#if isPublished}} <time datetime="{{unbound published_at}}" class="date published">
<time datetime="{{unbound published_at}}" class="date published"> Published {{format-timeago published_at}}
Published {{format-timeago published_at}} </time>
</time> {{/if}}
{{/if}} </span>
</span> </section>
</section> {{/link-to}}
{{/link-to}}
{{/view}}
{{/each}} {{/each}}
</ol> </ol>
</section> </section>

View file

@ -2,7 +2,7 @@ import itemView from 'ghost/views/item-view';
var PostItemView = itemView.extend({ var PostItemView = itemView.extend({
openEditor: function () { 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") }.on("doubleClick")
}); });