Skip to content

Commit

Permalink
EZP-31602: Moving to trash confirmation modal is not updated after su… (
Browse files Browse the repository at this point in the history
#289)

* EZP-31602: Moving to trash confirmation modal is not updated after sub-items bulk move

* After CR

* After CR

* After CR
  • Loading branch information
lucasOsti authored May 5, 2021
1 parent 014ac3f commit 53fc551
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/modules/sub-items/sub.items.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ export default class SubItemsModule extends Component {
this.updateTotalCountState(totalCount - movedLocations.length);
this.deselectAllItems();
this.discardActivePageItems();

this.updateTrashModal();
this.toggleBulkOperationStatusState(false);

if (notMovedLocations.length) {
Expand Down Expand Up @@ -571,7 +571,7 @@ export default class SubItemsModule extends Component {
this.updateTotalCountState(totalCount - deletedLocations.length);
this.deselectAllItems();
this.discardActivePageItems();

this.updateTrashModal();
this.toggleBulkOperationStatusState(false);

if (notDeletedLocations.length) {
Expand Down Expand Up @@ -739,11 +739,7 @@ export default class SubItemsModule extends Component {

return (
<Fragment>
<button
onClick={this.closeBulkDeletePopup}
type="button"
className="btn btn-dark"
data-dismiss="modal">
<button onClick={this.closeBulkDeletePopup} type="button" className="btn btn-dark" data-dismiss="modal">
{cancelLabel}
</button>
<button onClick={this.onBulkDeletePopupConfirm} type="button" className="btn btn-danger font-weight-bold btn--trigger">
Expand Down Expand Up @@ -822,7 +818,8 @@ export default class SubItemsModule extends Component {
isLoading={false}
size="medium"
footerChildren={this.renderConfirmationPopupFooter(selectionInfo)}
noHeader={true}>
noHeader={true}
>
<div className="m-sub-items__confirmation-modal-body">{confirmationMessage}</div>
</Popup>,
this.bulkDeleteModalContainer
Expand Down Expand Up @@ -988,6 +985,16 @@ export default class SubItemsModule extends Component {
);
}

updateTrashModal() {
document.body.dispatchEvent(
new CustomEvent('ez-trash-modal-refresh', {
detail: {
numberOfSubitems: this.state.totalCount,
},
})
);
}

render() {
const listTitle = Translator.trans(/*@Desc("Sub-items")*/ 'items_list.title', {}, 'sub_items');
const { selectedItems, activeView, totalCount, isDuringBulkOperation, activePageItems } = this.state;
Expand Down

0 comments on commit 53fc551

Please sign in to comment.