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

Improved bulk delete and unpublish modals copy

refs https://github.com/TryGhost/Team/issues/2677
This commit is contained in:
Simon Backx 2023-04-12 15:53:17 +02:00
parent 2df049b079
commit 8bdd23e1cc
5 changed files with 13 additions and 12 deletions

View file

@ -27,8 +27,7 @@ export default class PostsContextMenu extends Component {
async deletePosts() {
this.menu.close();
await this.modals.open(DeletePostsModal, {
isSingle: this.selectionList.isSingle,
count: this.selectionList.count,
selectionList: this.selectionList,
confirm: this.deletePostsTask
});
}
@ -37,8 +36,7 @@ export default class PostsContextMenu extends Component {
async unpublishPosts() {
this.menu.close();
await this.modals.open(UnpublishPostsModal, {
isSingle: this.selectionList.isSingle,
count: this.selectionList.count,
selectionList: this.selectionList,
confirm: this.unpublishPostsTask
});
}
@ -47,8 +45,7 @@ export default class PostsContextMenu extends Component {
async editPostsAccess() {
this.menu.close();
await this.modals.open(EditPostsAccessModal, {
isSingle: this.selectionList.isSingle,
count: this.selectionList.count,
selectionList: this.selectionList,
confirm: this.editPostsAccessTask
});
}

View file

@ -1,13 +1,13 @@
<div class="modal-content" data-test-modal="delete-posts">
<header class="modal-header">
<h1>Are you sure you want to delete {{if @data.isSingle 'this post' (concat @data.count ' posts')}}?</h1>
<h1>Are you sure you want to delete {{if @data.selectionList.isSingle 'this post' (concat @data.selectionList.count ' posts')}}?</h1>
</header>
<button type="button" class="close" title="Close" {{on "click" (fn @close false)}} data-test-button="close">{{svg-jar "close"}}<span class="hidden">Close</span></button>
<div class="modal-body">
<p>
You're about to delete {{if @data.isSingle 'this post' (concat @data.count ' posts')}}.
This is irreversible.
You're about to delete <strong>{{if @data.selectionList.isSingle (concat '"' @data.selectionList.first.title '"') (concat @data.selectionList.count ' posts')}}</strong>.
This is permanent! We warned you, k?
</p>
</div>

View file

@ -1,6 +1,6 @@
<div class="modal-content" data-test-modal="edit-posts-access">
<header class="modal-header">
<h1>Modify access for {{if @data.isSingle 'this post' (concat @data.count ' posts')}}</h1>
<h1>Modify access for {{if @data.selectionList.isSingle 'this post' (concat @data.selectionList.count ' posts')}}</h1>
</header>
<button type="button" class="close" title="Close" {{on "click" (fn @close false)}} data-test-button="close">{{svg-jar "close"}}<span class="hidden">Close</span></button>

View file

@ -1,12 +1,12 @@
<div class="modal-content" data-test-modal="unpublish-posts">
<header class="modal-header">
<h1>Are you sure you want to unpublish {{if @data.isSingle 'this post' (concat @data.count ' posts')}}?</h1>
<h1>Are you sure you want to unpublish {{if @data.selectionList.isSingle 'this post' (concat @data.selectionList.count ' posts')}}?</h1>
</header>
<button type="button" class="close" title="Close" {{on "click" (fn @close false)}} data-test-button="close">{{svg-jar "close"}}<span class="hidden">Close</span></button>
<div class="modal-body">
<p>
You're about to unpublish {{if @data.isSingle 'this post' (concat @data.count ' posts')}}.
You're about to unpublish <strong>{{if @data.selectionList.isSingle (concat '"' @data.selectionList.first.title '"') (concat @data.selectionList.count ' posts')}}</strong>.
</p>
</div>

View file

@ -67,6 +67,10 @@ export default class SelectionList {
return arr;
}
get first() {
return this.availableModels[0];
}
get isSingle() {
return this.selectedIds.size === 1 && !this.inverted;
}