ENHANCEMENT: Add 'Cancel' button to 'Add Page' form

This commit is contained in:
Loz Calver 2013-07-04 15:12:25 +01:00 committed by Ingo Schommer
parent e444b359ec
commit 95d9257b1b

View File

@ -10,6 +10,7 @@ class CMSPageAddController extends CMSPageEditController {
private static $allowed_actions = array(
'AddForm',
'doAdd',
'doCancel'
);
/**
@ -108,9 +109,11 @@ class CMSPageAddController extends CMSPageEditController {
}
$actions = new FieldList(
// $resetAction = new ResetFormAction('doCancel', _t('CMSMain.Cancel', 'Cancel')),
FormAction::create("doAdd", _t('CMSMain.Create',"Create"))
->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')
->setUseButtonTag(true),
FormAction::create("doCancel", _t('CMSMain.Cancel',"Cancel"))
->addExtraClass('ss-ui-action-destructive')
->setUseButtonTag(true)
);
@ -174,4 +177,8 @@ class CMSPageAddController extends CMSPageEditController {
return $this->redirect(Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID));
}
public function doCancel($data, $form) {
return $this->redirect(singleton('CMSMain')->Link());
}
}