diff --git a/ghost/admin/app/models/collection.js b/ghost/admin/app/models/collection.js index f998fed1db..fb736f474e 100644 --- a/ghost/admin/app/models/collection.js +++ b/ghost/admin/app/models/collection.js @@ -1,5 +1,7 @@ -import Model, {attr} from '@ember-data/model'; +import Model from '@ember-data/model'; import ValidationEngine from 'ghost-admin/mixins/validation-engine'; +import {attr} from '@ember-data/model'; +import {computed} from '@ember/object'; import {inject as service} from '@ember/service'; export default Model.extend(ValidationEngine, { @@ -17,5 +19,15 @@ export default Model.extend(ValidationEngine, { updatedBy: attr('number'), count: attr('raw'), + posts: attr('raw'), + + postIds: computed('posts', function () { + if (this.posts && this.posts.length) { + return this.posts.map(post => post.id); + } else { + return []; + } + }), + feature: service() }); diff --git a/ghost/admin/app/templates/collection.hbs b/ghost/admin/app/templates/collection.hbs index 7c55fa109c..10f6ff4829 100644 --- a/ghost/admin/app/templates/collection.hbs +++ b/ghost/admin/app/templates/collection.hbs @@ -34,4 +34,15 @@ {{/unless}} + + {{#if this.collection.postIds}} +
+

Collection has {{this.collection.postIds.length}} posts

+
    + {{#each this.collection.postIds as |post|}} +
  1. {{post}}
  2. + {{/each}} +
+
+ {{/if}}