chg: [inbox] Improved layouts

pull/41/head
mokaddem 2021-03-18 09:26:01 +01:00
parent 414ac9a59f
commit 0a1294bbee
5 changed files with 23 additions and 5 deletions

View File

@ -59,6 +59,9 @@ class InboxController extends AppController
public function delete($id) public function delete($id)
{ {
$this->set('deletionTitle', __('Discard request'));
$this->set('deletionText', __('Are you sure you want to discard request #{0}?', $id));
$this->set('deletionConfirm', __('Discard'));
$this->CRUD->delete($id); $this->CRUD->delete($id);
$responsePayload = $this->CRUD->getResponsePayload(); $responsePayload = $this->CRUD->getResponsePayload();
if (!empty($responsePayload)) { if (!empty($responsePayload)) {

View File

@ -75,12 +75,17 @@ echo $this->element('genericElements/IndexTable/index_table', [
'description' => __('A list of requests to be manually processed'), 'description' => __('A list of requests to be manually processed'),
'actions' => [ 'actions' => [
[ [
'open_modal' => '/inbox/process/[onclick_params_data_path]', 'url' => '/inbox/view',
'modal_params_data_path' => 'id', 'url_params_data_paths' => ['id'],
'icon' => 'eye' 'icon' => 'eye'
], ],
[ [
'open_modal' => '/individuals/delete/[onclick_params_data_path]', 'open_modal' => '/inbox/process/[onclick_params_data_path]',
'modal_params_data_path' => 'id',
'icon' => 'cogs'
],
[
'open_modal' => '/inbox/delete/[onclick_params_data_path]',
'modal_params_data_path' => 'id', 'modal_params_data_path' => 'id',
'icon' => 'trash' 'icon' => 'trash'
], ],

View File

@ -43,6 +43,7 @@ echo $this->element(
[ [
'key' => 'data', 'key' => 'data',
'path' => 'data', 'path' => 'data',
'type' => 'json'
], ],
], ],
'children' => [] 'children' => []

View File

@ -0,0 +1,3 @@
<?php
$value = Cake\Utility\Hash::extract($data, $field['path']);
echo sprintf('<pre><code>%s</pre></code>', h(json_encode($value, JSON_PRETTY_PRINT)));

View File

@ -1,7 +1,13 @@
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title"><?= __('Delete {0}', h(Cake\Utility\Inflector::singularize(Cake\Utility\Inflector::humanize($this->request->getParam('controller'))))) ?></h5> <h5 class="modal-title">
<?php if (empty($deletionTitle)): ?>
<p><?= __('Delete {0}', h(Cake\Utility\Inflector::singularize(Cake\Utility\Inflector::humanize($this->request->getParam('controller'))))) ?></p>
<?php else: ?>
<p><?= h($deletionTitle) ?></p>
<?php endif; ?>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
@ -15,7 +21,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<?= $this->Form->postLink( <?= $this->Form->postLink(
'Delete', !empty($deletionConfirm) ? h($deletionConfirm) : __('Delete'),
(empty($postLinkParameters) ? ['action' => 'delete', $id] : $postLinkParameters), (empty($postLinkParameters) ? ['action' => 'delete', $id] : $postLinkParameters),
['class' => 'btn btn-danger button-execute', 'id' => 'submitButton'] ['class' => 'btn btn-danger button-execute', 'id' => 'submitButton']
) )