diff --git a/javascript/AssetAdmin.js b/javascript/AssetAdmin.js index 07af0452..3154af8f 100644 --- a/javascript/AssetAdmin.js +++ b/javascript/AssetAdmin.js @@ -24,8 +24,15 @@ $.entwine('ss', function($){ + /** + * Load folder detail view via controller methods + * rather than built-in GridField view (which is only geared towards showing files). + */ $('#Form_EditForm_File .ss-gridfield-item').entwine({ onclick: function(e) { + // Let actions do their own thing + if($(e.target).is('.action')) return; + var grid = this.closest('.ss-gridfield'); if(this.data('class') == 'Folder') { var url = grid.data('urlFolderTemplate').replace('%s', this.data('id')); @@ -34,7 +41,14 @@ } } }); - + + $('.cms-edit-form :submit[name=action_delete]').entwine({ + onclick: function(e) { + if(!confirm(ss.i18n._t('AssetAdmin.ConfirmDelete'))) return false; + else this._super(e); + } + }); + /** * Class: #Form_SyncForm */ diff --git a/javascript/lang/en_US.js b/javascript/lang/en_US.js index c6f30566..7124a7cb 100644 --- a/javascript/lang/en_US.js +++ b/javascript/lang/en_US.js @@ -34,6 +34,7 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') { 'AssetTableField.MOVING': 'Moving %s file(s)', 'SecurityAdmin.BATCHACTIONSDELETECONFIRM': "Do you really want to delete %s groups?", 'CMSMAIN.AddSearchCriteria': 'Add Criteria', - 'WidgetAreaEditor.TOOMANY': 'Sorry, you have reached the maximum number of widgets in this area' + 'WidgetAreaEditor.TOOMANY': 'Sorry, you have reached the maximum number of widgets in this area', + 'AssetAdmin.ConfirmDelete': 'Do you really want to delete this folder and all contained files?' }); }