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:
Luke Edwards 2018-08-24 13:13:32 +12:00 committed by Aaron Carlino
parent 050afd79c1
commit 6164d01d65
3 changed files with 4 additions and 4 deletions

View File

@ -245,8 +245,8 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio
"deleterecord",
['RecordID' => $record->ID]
)
->addExtraClass('gridfield-button-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')
->addExtraClass('action--delete btn--icon-md font-icon-trash-bin btn--no-text grid-field__icon-action action-menu--handled')
->setAttribute('classNames', 'action--delete font-icon-trash')
->setDescription($title)
->setAttribute('aria-label', $title);
}

View File

@ -288,7 +288,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
if ($canDelete) {
$actions->push(FormAction::create('doDelete', _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Delete', 'Delete'))
->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
//Change the Save label to 'Create'

View File

@ -85,7 +85,7 @@ class GridFieldDeleteActionTest extends SapphireTest
{
$this->logInWithPermission('ADMIN');
$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.');
}