mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Confirming deletion of records in GridField via JavaScript alert
This commit is contained in:
parent
3c29a9268c
commit
abedf2a4a9
@ -712,6 +712,7 @@ class GridField_Action extends FormAction {
|
||||
|
||||
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
|
||||
Requirements::javascript(THIRDPARTY_DIR . '/json-js/json2.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/i18n.js');
|
||||
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/GridField.js');
|
||||
|
||||
@ -729,7 +730,7 @@ class GridField_Action extends FormAction {
|
||||
|
||||
// And generate field
|
||||
$attributes = array(
|
||||
'class' => 'action' . ($this->extraClass() ? $this->extraClass() : ''),
|
||||
'class' => ($this->extraClass() ? $this->extraClass() : '') . ' action-' . $this->actionName,
|
||||
'id' => $this->id(),
|
||||
'type' => 'submit',
|
||||
// Note: This field needs to be less than 65 chars, otherwise Suhosin security patch
|
||||
|
@ -27,7 +27,7 @@
|
||||
if(successCallback) successCallback.apply(this, arguments);
|
||||
},
|
||||
error: function(e) {
|
||||
alert(ss.i18n._t('GRIDFIELD.ERRORINTRANSACTION', 'An error occured while fetching data from the server\n Please try again later.'));
|
||||
alert(ss.i18n._t('GRIDFIELD.ERRORINTRANSACTION'));
|
||||
form.removeClass('loading');
|
||||
}
|
||||
}, ajaxOpts));
|
||||
@ -64,6 +64,13 @@
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
$('fieldset.ss-gridfield .action-deleterecord').entwine({
|
||||
onclick: function(e){
|
||||
if(!confirm(ss.i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE'))) return false;
|
||||
else this._super(e);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Upon focusing on a filter <input> element, move "filter" and "reset" buttons and display next to the current <input> element
|
||||
|
@ -16,7 +16,7 @@ jQuery(function($){
|
||||
data: form.serialize()+'&'+escape(searchField.attr('name'))+'='+escape(searchField.val()),
|
||||
success: function(data) {
|
||||
response( $.map(JSON.parse(data), function( name, id ) {
|
||||
return { label: name, value: name, id: id }
|
||||
return { label: name, value: name, id: id };
|
||||
}));
|
||||
},
|
||||
error: function(e) {
|
||||
|
Loading…
Reference in New Issue
Block a user