mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Improved default post access for bulk modal
refs https://github.com/TryGhost/Team/issues/2677 - Use post access level by default when doing single selection - Use default access level from settings when selecting multiple posts
This commit is contained in:
parent
8bdd23e1cc
commit
25d53f15b8
2 changed files with 23 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
<div class="modal-content" data-test-modal="edit-posts-access">
|
||||
<div class="modal-content" data-test-modal="edit-posts-access" {{did-insert this.setup}}>
|
||||
<header class="modal-header">
|
||||
<h1>Modify access for {{if @data.selectionList.isSingle 'this post' (concat @data.selectionList.count ' posts')}}</h1>
|
||||
</header>
|
||||
|
|
|
@ -6,12 +6,30 @@ import {tracked} from '@glimmer/tracking';
|
|||
|
||||
export default class EditPostsAccessModal extends Component {
|
||||
@service store;
|
||||
@service settings;
|
||||
|
||||
// We createa new post model to use the same validations as the post model
|
||||
@tracked post = this.store.createRecord('post', {
|
||||
visibility: 'public',
|
||||
tiers: []
|
||||
});
|
||||
@tracked post = this.store.createRecord('post', {});
|
||||
|
||||
get selectionList() {
|
||||
return this.args.data.selectionList;
|
||||
}
|
||||
|
||||
@action
|
||||
setup() {
|
||||
if (this.selectionList.first && this.selectionList.isSingle) {
|
||||
this.post.set('visibility', this.selectionList.first.visibility);
|
||||
this.post.set('tiers', this.selectionList.first.tiers);
|
||||
} else {
|
||||
// Use default
|
||||
this.post.set('visibility', this.settings.defaultContentVisibility);
|
||||
this.post.set('tiers', this.settings.defaultContentVisibilityTiers.map((tier) => {
|
||||
return {
|
||||
id: tier
|
||||
};
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
async validate() {
|
||||
// Mark as not new
|
||||
|
|
Loading…
Add table
Reference in a new issue