Skip to content

Commit

Permalink
VCST-2186: context menu won't disappear after deletion (#756)
Browse files Browse the repository at this point in the history
fix: Resolve the issue of the context menu not disappearing after deletion for product assets. (#756)
feat: Added confirmation dialog before deleting operation for product assets. (#756)
feat: Added confirmation dialog before deleting operation for product images. (#756)
  • Loading branch information
OlegoO committed Nov 15, 2024
1 parent 7235a85 commit 57f3d88
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 14 deletions.
33 changes: 26 additions & 7 deletions src/VirtoCommerce.CatalogModule.Web/Scripts/blades/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,17 @@ angular.module('virtoCommerce.catalogModule')
$scope.removeItem = function(image) {
var idx = blade.currentEntities.indexOf(image);
if (idx >= 0) {
blade.currentEntities.splice(idx, 1);
var dialog = {
id: "confirmDeleteItem",
title: "platform.dialogs.folders-delete.title",
message: "platform.dialogs.folders-delete.message",
callback: function (remove) {
if (remove) {
blade.currentEntities.splice(idx, 1);
}
}
}
dialogService.showConfirmationDialog(dialog);
}
};

Expand All @@ -77,13 +87,22 @@ angular.module('virtoCommerce.catalogModule')
selectedImages = $scope.gridApi.selection.getSelectedRows();
}

angular.forEach(selectedImages,
function(image) {
var idx = blade.currentEntities.indexOf(image);
if (idx >= 0) {
blade.currentEntities.splice(idx, 1);
var dialog = {
id: "confirmDeleteItem",
title: "platform.dialogs.folders-delete.title",
message: "platform.dialogs.folders-delete.message",
callback: function (remove) {
if (remove) {
angular.forEach(selectedImages, function (image) {
var idx = blade.currentEntities.indexOf(image);
if (idx >= 0) {
blade.currentEntities.splice(idx, 1);
}
});
}
});
}
}
dialogService.showConfirmationDialog(dialog);
};

$scope.edit = function(entity) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
angular.module('virtoCommerce.catalogModule')
.controller('virtoCommerce.catalogModule.itemAssetController', ['$scope', '$translate', 'platformWebApp.bladeNavigationService', '$filter', 'platformWebApp.uiGridHelper', '$timeout', 'platformWebApp.settings', function ($scope, $translate, bladeNavigationService, $filter, uiGridHelper, $timeout, settings) {
.controller('virtoCommerce.catalogModule.itemAssetController', ['$scope', '$translate', 'platformWebApp.bladeNavigationService', '$filter', 'platformWebApp.uiGridHelper', '$timeout', 'platformWebApp.settings', 'platformWebApp.dialogService',
function ($scope, $translate, bladeNavigationService, $filter, uiGridHelper, $timeout, settings, dialogService) {
var blade = $scope.blade;
blade.headIcon = 'fa fa-chain';

Expand Down Expand Up @@ -165,7 +166,17 @@ angular.module('virtoCommerce.catalogModule')
$scope.removeItem = function (image) {
var idx = blade.currentEntities.indexOf(image);
if (idx >= 0) {
blade.currentEntities.splice(idx, 1);
var dialog = {
id: "confirmDeleteItem",
title: "platform.dialogs.folders-delete.title",
message: "platform.dialogs.folders-delete.message",
callback: function (remove) {
if (remove) {
blade.currentEntities.splice(idx, 1);
}
}
}
dialogService.showConfirmationDialog(dialog);
}
};

Expand All @@ -179,12 +190,22 @@ angular.module('virtoCommerce.catalogModule')
selectedImages = $scope.gridApi.selection.getSelectedRows();
}

angular.forEach(selectedImages, function (image) {
var idx = blade.currentEntities.indexOf(image);
if (idx >= 0) {
blade.currentEntities.splice(idx, 1);
var dialog = {
id: "confirmDeleteItem",
title: "platform.dialogs.folders-delete.title",
message: "platform.dialogs.folders-delete.message",
callback: function (remove) {
if (remove) {
angular.forEach(selectedImages, function (image) {
var idx = blade.currentEntities.indexOf(image);
if (idx >= 0) {
blade.currentEntities.splice(idx, 1);
}
});
}
}
});
}
dialogService.showConfirmationDialog(dialog);
};

initialize(blade.item);
Expand Down

0 comments on commit 57f3d88

Please sign in to comment.