mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Cleanup posts template.
No issue. * Fix indentation (it was surprisingly hard for me to grok what was happening without indentation). * Utilize `alternateActive` from `core/client/utils/link-view.js` to maintain the `active` state. Observing `childViews` is deprecated (and may not work properly in future versions of Ember). * Remove now unused `item-view`.
This commit is contained in:
parent
d2bb1dd613
commit
b56c26c597
3 changed files with 21 additions and 30 deletions
|
@ -14,24 +14,24 @@
|
||||||
{{#view "paginated-scroll-box" tagName="section" classNames="content-list-content js-content-scrollbox"}}
|
{{#view "paginated-scroll-box" tagName="section" classNames="content-list-content js-content-scrollbox"}}
|
||||||
<ol class="posts-list">
|
<ol class="posts-list">
|
||||||
{{#each post in model itemController="posts/post" itemView="post-item-view" itemTagName="li"}}
|
{{#each post in model itemController="posts/post" itemView="post-item-view" itemTagName="li"}}
|
||||||
{{#link-to "posts.post" post class="permalink" title="Edit this post"}}
|
{{#link-to "posts.post" post class="permalink" alternateActive=view.active title="Edit this post"}}
|
||||||
<h3 class="entry-title">{{post.title}}</h3>
|
<h3 class="entry-title">{{post.title}}</h3>
|
||||||
<section class="entry-meta">
|
<section class="entry-meta">
|
||||||
<span class="status">
|
<span class="status">
|
||||||
{{#if post.isPublished}}
|
{{#if post.isPublished}}
|
||||||
{{#if post.page}}
|
{{#if post.page}}
|
||||||
<span class="page">Page</span>
|
<span class="page">Page</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
<time datetime="{{unbound post.published_at}}" class="date published">
|
<time datetime="{{unbound post.published_at}}" class="date published">
|
||||||
Published {{gh-format-timeago post.published_at}}
|
Published {{gh-format-timeago post.published_at}}
|
||||||
</time>
|
</time>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class="draft">Draft</span>
|
<span class="draft">Draft</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</span>
|
</span>
|
||||||
</section>
|
</section>
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ol>
|
</ol>
|
||||||
{{/view}}
|
{{/view}}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
var ItemView = Ember.View.extend({
|
|
||||||
classNameBindings: ['active'],
|
|
||||||
|
|
||||||
active: Ember.computed('childViews.firstObject.active', function () {
|
|
||||||
return this.get('childViews.firstObject.active');
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
export default ItemView;
|
|
|
@ -1,7 +1,7 @@
|
||||||
import itemView from 'ghost/views/item-view';
|
var PostItemView = Ember.View.extend({
|
||||||
|
classNameBindings: ['active', 'isFeatured:featured', 'isPage:page'],
|
||||||
|
|
||||||
var PostItemView = itemView.extend({
|
active: null,
|
||||||
classNameBindings: ['isFeatured:featured', 'isPage:page'],
|
|
||||||
|
|
||||||
isFeatured: Ember.computed.alias('controller.model.featured'),
|
isFeatured: Ember.computed.alias('controller.model.featured'),
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue