From c9bf1a0bc25100a5e9fdfdb6f2a1c06901db24a6 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Wed, 7 Oct 2020 16:08:34 +0200 Subject: [PATCH] Add confirmation dialog to media picker "remove all entries" action --- .../mediapicker/mediapicker.controller.js | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js index 9cb0bfb3af..f3a57224e2 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js @@ -1,7 +1,7 @@ //this controller simply tells the dialogs service to open a mediaPicker window //with a specified callback, this callback will receive an object with a selection on it angular.module('umbraco').controller("Umbraco.PropertyEditors.MediaPickerController", - function ($scope, entityResource, mediaHelper, $timeout, userService, localizationService, editorService, angularHelper) { + function ($scope, entityResource, mediaHelper, $timeout, userService, localizationService, editorService, angularHelper, overlayService) { var vm = this; @@ -242,10 +242,22 @@ angular.module('umbraco').controller("Umbraco.PropertyEditors.MediaPickerControl } function removeAllEntries() { - $scope.mediaItems.length = 0;// AngularJS way to empty the array. - $scope.ids.length = 0;// AngularJS way to empty the array. - sync(); - setDirty(); + localizationService.localizeMany(["content_nestedContentDeleteAllItems", "general_delete"]).then(function (data) { + overlayService.confirmDelete({ + title: data[1], + content: data[0], + close: function () { + overlayService.close(); + }, + submit: function () { + $scope.mediaItems.length = 0;// AngularJS way to empty the array. + $scope.ids.length = 0;// AngularJS way to empty the array. + sync(); + setDirty(); + overlayService.close(); + } + }); + }); } var removeAllEntriesAction = {