mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX GridField delete button to offer archive action if possible (#8325)
* FIX GridField delete button to offer archive action if possible * Refactor archive action to versioned module * Fix GridFieldDeleteAction test
This commit is contained in:
parent
050afd79c1
commit
6164d01d65
@ -245,8 +245,8 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio
|
|||||||
"deleterecord",
|
"deleterecord",
|
||||||
['RecordID' => $record->ID]
|
['RecordID' => $record->ID]
|
||||||
)
|
)
|
||||||
->addExtraClass('gridfield-button-delete btn--icon-md font-icon-trash-bin btn--no-text grid-field__icon-action action-menu--handled')
|
->addExtraClass('action--delete btn--icon-md font-icon-trash-bin btn--no-text grid-field__icon-action action-menu--handled')
|
||||||
->setAttribute('classNames', 'gridfield-button-delete font-icon-trash')
|
->setAttribute('classNames', 'action--delete font-icon-trash')
|
||||||
->setDescription($title)
|
->setDescription($title)
|
||||||
->setAttribute('aria-label', $title);
|
->setAttribute('aria-label', $title);
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
|||||||
if ($canDelete) {
|
if ($canDelete) {
|
||||||
$actions->push(FormAction::create('doDelete', _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Delete', 'Delete'))
|
$actions->push(FormAction::create('doDelete', _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Delete', 'Delete'))
|
||||||
->setUseButtonTag(true)
|
->setUseButtonTag(true)
|
||||||
->addExtraClass('btn-outline-danger btn-hide-outline font-icon-trash-bin action-delete'));
|
->addExtraClass('btn-outline-danger btn-hide-outline font-icon-trash-bin action--delete'));
|
||||||
}
|
}
|
||||||
} else { // adding new record
|
} else { // adding new record
|
||||||
//Change the Save label to 'Create'
|
//Change the Save label to 'Create'
|
||||||
|
@ -85,7 +85,7 @@ class GridFieldDeleteActionTest extends SapphireTest
|
|||||||
{
|
{
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
$content = new CSSContentParser($this->gridField->FieldHolder());
|
$content = new CSSContentParser($this->gridField->FieldHolder());
|
||||||
$deleteButtons = $content->getBySelector('.gridfield-button-delete');
|
$deleteButtons = $content->getBySelector('.action--delete');
|
||||||
$this->assertEquals(3, count($deleteButtons), 'Delete buttons should show when logged in.');
|
$this->assertEquals(3, count($deleteButtons), 'Delete buttons should show when logged in.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user