From 18f54bb99ae0320db39b9eedb68b491ca52ef91c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 21 Nov 2009 03:19:14 +0000 Subject: [PATCH] MINOR Added javascript confirmation for 'delete folders' batch action in AssetAdmin.js git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92806 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/AssetAdmin.js | 28 ++++++++++++++++++++++++++++ javascript/lang/en_US.js | 3 ++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/javascript/AssetAdmin.js b/javascript/AssetAdmin.js index 3e61d0c4..b94bd58c 100755 --- a/javascript/AssetAdmin.js +++ b/javascript/AssetAdmin.js @@ -16,6 +16,34 @@ var _HANDLER_FORMS = { }; (function($) { + $('.AssetAdmin').concrete('ss', function($) { + return { + onmatch: function() { + + this._super(); + } + }; + }); + + /** + * Delete selected folders through "batch actions" tab. + */ + $('#Form_BatchActionsForm').concrete('ss').register( + 'admin/assets/batchactions/delete', + function(ids) { + var confirmed = confirm( + ss.i18n.sprintf( + ss.i18n._t( + 'AssetAdmin.BATCHACTIONSDELETECONFIRM', + "Do you really want to delete %d folders?" + ), + ids.length + ) + ); + return (confirmed) ? ids : false; + } + ); + /** * @class Simple form with a page type dropdown * which creates a new page through #Form_EditForm and adds a new tree node. diff --git a/javascript/lang/en_US.js b/javascript/lang/en_US.js index ac4710b9..7b02665b 100644 --- a/javascript/lang/en_US.js +++ b/javascript/lang/en_US.js @@ -27,6 +27,7 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') { 'LeftAndMain.CONFIRMUNSAVED': "Are you sure you want to navigate away from this page?\n\nWARNING: Your changes have not been saved.\n\nPress OK to continue, or Cancel to stay on the current page.", 'LeftAndMain.CONFIRMUNSAVEDSHORT': "WARNING: Your changes have not been saved.", 'CMSMAIN.ALERTCLASSNAME': 'The page type will be updated after the page is saved', - 'CMSMAIN.URLSEGMENTVALIDATION': 'URLs can only be made up of letters, digits and hyphens.' + 'CMSMAIN.URLSEGMENTVALIDATION': 'URLs can only be made up of letters, digits and hyphens.', + 'AssetAdmin.BATCHACTIONSDELETECONFIRM': "Do you really want to delete %d folders?" }); } \ No newline at end of file