From 273a782fcb667c373ef3025b2ef6222656d10b77 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Wed, 31 Dec 2014 21:06:05 -0500 Subject: [PATCH] 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`. --- core/client/templates/posts.hbs | 36 ++++++++++++++--------------- core/client/views/item-view.js | 9 -------- core/client/views/post-item-view.js | 6 ++--- 3 files changed, 21 insertions(+), 30 deletions(-) delete mode 100644 core/client/views/item-view.js diff --git a/core/client/templates/posts.hbs b/core/client/templates/posts.hbs index 0e5a3e8683..37f7eeaa31 100644 --- a/core/client/templates/posts.hbs +++ b/core/client/templates/posts.hbs @@ -14,24 +14,24 @@ {{#view "paginated-scroll-box" tagName="section" classNames="content-list-content js-content-scrollbox"}}
    {{#each post in model itemController="posts/post" itemView="post-item-view" itemTagName="li"}} - {{#link-to "posts.post" post class="permalink" title="Edit this post"}} -

    {{post.title}}

    - - {{/link-to}} + {{#link-to "posts.post" post class="permalink" alternateActive=view.active title="Edit this post"}} +

    {{post.title}}

    + + {{/link-to}} {{/each}}
{{/view}} diff --git a/core/client/views/item-view.js b/core/client/views/item-view.js deleted file mode 100644 index 4b713340df..0000000000 --- a/core/client/views/item-view.js +++ /dev/null @@ -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; diff --git a/core/client/views/post-item-view.js b/core/client/views/post-item-view.js index cdda131696..2687ad8056 100644 --- a/core/client/views/post-item-view.js +++ b/core/client/views/post-item-view.js @@ -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({ - classNameBindings: ['isFeatured:featured', 'isPage:page'], + active: null, isFeatured: Ember.computed.alias('controller.model.featured'),