mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-21 00:46:07 +02:00
More specific entwine rule for delete alert in GridField
The rule didn't apply in Firefox because of how it handles specificity, so made it a bit more specific (added "button" and ".action")
This commit is contained in:
parent
d325551079
commit
02cc662aaf
@ -200,6 +200,15 @@
|
|||||||
* Function: onclick
|
* Function: onclick
|
||||||
*/
|
*/
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
|
// Confirmation on delete.
|
||||||
|
if(
|
||||||
|
this.hasClass('gridfield-button-delete')
|
||||||
|
&& !confirm(ss.i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE'))
|
||||||
|
) {
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(!this.is(':disabled')) {
|
if(!this.is(':disabled')) {
|
||||||
this.parents('form').trigger('submit', [this]);
|
this.parents('form').trigger('submit', [this]);
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler {
|
|||||||
if($canDelete) {
|
if($canDelete) {
|
||||||
$actions->push(FormAction::create('doDelete', _t('GridFieldDetailForm.Delete', 'Delete'))
|
$actions->push(FormAction::create('doDelete', _t('GridFieldDetailForm.Delete', 'Delete'))
|
||||||
->setUseButtonTag(true)
|
->setUseButtonTag(true)
|
||||||
->addExtraClass('ss-ui-action-destructive'));
|
->addExtraClass('ss-ui-action-destructive action-delete'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{ // adding new record
|
}else{ // adding new record
|
||||||
|
@ -135,7 +135,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.ss-gridfield .action.gridfield-button-delete, .cms-content-actions .ss-ui-action-destructive .ui-button-text').entwine({
|
// Covers both tabular delete button, and the button on the detail form
|
||||||
|
$('.ss-gridfield .Actions .action.gridfield-button-delete, .cms-edit-form .Actions button.action.action-delete').entwine({
|
||||||
onclick: function(e){
|
onclick: function(e){
|
||||||
if(!confirm(ss.i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE'))) {
|
if(!confirm(ss.i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE'))) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
Loading…
Reference in New Issue
Block a user