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 0730f39 commit aae1db8
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 @@ -46,7 +46,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 @@ -70,13 +80,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 @@ -158,7 +159,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 @@ -172,12 +183,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 aae1db8

Please sign in to comment.