fix: [encryption keys] adding a key correctly returns the expected view elements
- also some minor tweaks on the index - CRUD component now accepts a redirect parameter - as reported by cert.plpull/32/head
parent
2f7624f71c
commit
d04efb232c
|
@ -96,7 +96,11 @@ class CRUDComponent extends Component
|
|||
$this->Controller->render($params['displayOnSuccess']);
|
||||
return;
|
||||
}
|
||||
$this->Controller->redirect(['action' => 'view', $data->id]);
|
||||
if (empty($params['redirect'])) {
|
||||
$this->Controller->redirect(['action' => 'view', $id]);
|
||||
} else {
|
||||
$this->Controller->redirect($params['redirect']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$validationMessage = $this->prepareValidationError($data);
|
||||
|
@ -194,7 +198,11 @@ class CRUDComponent extends Component
|
|||
$this->Controller->restResponsePayload = $this->RestResponse->viewData($data, 'json');
|
||||
} else {
|
||||
$this->Controller->Flash->success($message);
|
||||
$this->Controller->redirect(['action' => 'view', $id]);
|
||||
if (empty($params['redirect'])) {
|
||||
$this->Controller->redirect(['action' => 'view', $id]);
|
||||
} else {
|
||||
$this->Controller->redirect($params['redirect']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$validationMessage = $this->prepareValidationError($data);
|
||||
|
|
|
@ -37,7 +37,7 @@ class EncryptionKeysController extends AppController
|
|||
|
||||
public function add()
|
||||
{
|
||||
$this->CRUD->add(['displayOnSuccess' => 'add_success']);
|
||||
$this->CRUD->add(['redirect' => $this->referer()]);
|
||||
if ($this->ParamHandler->isRest()) {
|
||||
return $this->restResponsePayload;
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
|||
'data_path' => 'id',
|
||||
],
|
||||
[
|
||||
'name' => __('Owner type'),
|
||||
'sort' => 'owner_type',
|
||||
'data_path' => 'owner_type',
|
||||
'name' => __('Type'),
|
||||
'sort' => 'type',
|
||||
'data_path' => 'type',
|
||||
],
|
||||
[
|
||||
'name' => __('Owner ID'),
|
||||
|
@ -64,8 +64,7 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
|||
],
|
||||
[
|
||||
'name' => __('Key'),
|
||||
'data_path' => 'encryption_key',
|
||||
'privacy' => 1
|
||||
'data_path' => 'encryption_key'
|
||||
],
|
||||
],
|
||||
'title' => __('Encryption key Index'),
|
||||
|
|
Loading…
Reference in New Issue