0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added basic UI for collection posts

refs https://github.com/TryGhost/Team/issues/3169

- Added a lits to a collection view showing which posts belong to a collection.
This commit is contained in:
Naz 2023-06-19 14:37:51 +07:00
parent 1a868e08ef
commit 8d9d9de8d4
No known key found for this signature in database
2 changed files with 24 additions and 1 deletions

View file

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

View file

@ -34,4 +34,15 @@
</button>
</div>
{{/unless}}
{{#if this.collection.postIds}}
<div class="gh-main-section">
<h3>Collection has {{this.collection.postIds.length}} posts</h3>
<ol class="gh-list">
{{#each this.collection.postIds as |post|}}
<li class="gh-list-row"><a href="#/editor/post/{{post}}">{{post}}</a></li>
{{/each}}
</ol>
</div>
{{/if}}
</section>