chg: [genericTemplate:delete] Support of single and bulk delete operations
parent
bb6489778f
commit
467f549afc
|
@ -1,39 +1,31 @@
|
||||||
<div class="modal-dialog" role="document">
|
<?php
|
||||||
<div class="modal-content">
|
$form = $this->element('genericElements/Form/genericForm', [
|
||||||
<div class="modal-header">
|
'entity' => null,
|
||||||
<h5 class="modal-title">
|
'ajax' => false,
|
||||||
<?php if (empty($deletionTitle)): ?>
|
'raw' => true,
|
||||||
<p><?= __('Delete {0}', h(Cake\Utility\Inflector::singularize(Cake\Utility\Inflector::humanize($this->request->getParam('controller'))))) ?></p>
|
'data' => [
|
||||||
<?php else: ?>
|
'fields' => [
|
||||||
<p><?= h($deletionTitle) ?></p>
|
[
|
||||||
<?php endif; ?>
|
'type' => 'text',
|
||||||
</h5>
|
'field' => 'ids',
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
'default' => !empty($id) ? json_encode([$id]) : ''
|
||||||
<span aria-hidden="true">×</span>
|
]
|
||||||
</button>
|
],
|
||||||
</div>
|
'submit' => [
|
||||||
<div class="modal-body">
|
'action' => $this->request->getParam('action')
|
||||||
<?php if (empty($deletionText)): ?>
|
]
|
||||||
<p><?= __('Are you sure you want to delete {0} #{1}?', h(Cake\Utility\Inflector::singularize($this->request->getParam('controller'))), h($id)) ?></p>
|
]
|
||||||
<?php else: ?>
|
]);
|
||||||
<p><?= h($deletionText) ?></p>
|
$formHTML = sprintf('<div class="d-none">%s</div>', $form);
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
$bodyMessage = !empty($deletionText) ? __($deletionText) : __('Are you sure you want to delete {0} #{1}?', h(Cake\Utility\Inflector::singularize($this->request->getParam('controller'))), h($id));
|
||||||
<div class="modal-footer">
|
$bodyHTML = sprintf('%s%s', $formHTML, $bodyMessage);
|
||||||
<?= $this->Form->postLink(
|
|
||||||
!empty($deletionConfirm) ? h($deletionConfirm) : __('Delete'),
|
echo $this->Bootstrap->modal([
|
||||||
(empty($postLinkParameters) ? ['action' => 'delete', $id] : $postLinkParameters),
|
'size' => 'lg',
|
||||||
['class' => 'btn btn-danger button-execute', 'id' => 'submitButton']
|
'title' => !empty($deletionTitle) ? $deletionTitle : __('Delete {0}', h(Cake\Utility\Inflector::singularize(Cake\Utility\Inflector::humanize($this->request->getParam('controller'))))),
|
||||||
)
|
'type' => 'confirm-danger',
|
||||||
|
'confirmText' => !empty($deletionConfirm) ? $deletionConfirm : __('Delete'),
|
||||||
|
'bodyHtml' => $bodyHTML,
|
||||||
|
]);
|
||||||
?>
|
?>
|
||||||
<button type="button" class="btn btn-secondary cancel-button" data-dismiss="modal"><?= __('Cancel') ?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).keydown(function(e) {
|
|
||||||
if(e.which === 13 && e.ctrlKey) {
|
|
||||||
$('.button-execute').click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
Loading…
Reference in New Issue