chg: [element:genericForm] Usage of bootstrap component to generate ajax modal

pull/93/head
Sami Mokaddem 2021-11-05 17:44:05 +01:00
parent 26859d045e
commit fc436e89e2
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 6 additions and 4 deletions

View File

@ -1076,6 +1076,7 @@ class BoostrapModal extends BootstrapGeneric {
private function genModal()
{
$this->options['modalClass'] = !empty($this->options['modalClass']) && !is_array($this->options['modalClass'])? [$this->options['modalClass']] : $this->options['modalClass'];
$dialog = $this->openNode('div', [
'class' => array_merge(
['modal-dialog', (!empty($this->options['size'])) ? "modal-{$this->options['size']}" : ''],

View File

@ -106,17 +106,18 @@
$modelName = h(\Cake\Utility\Inflector::humanize(\Cake\Utility\Inflector::singularize($this->request->getParam('controller'))));
if (!empty($ajax)) {
$seedModal = 'mseed-' . mt_rand();
echo $this->element('genericElements/genericModal', [
echo $this->Bootstrap->modal([
'title' => empty($data['title']) ? sprintf('%s %s', $actionName, $modelName) : h($data['title']),
'body' => $this->element('genericElements/Form/formLayouts/formRaw', [
'bodyHtml' => $this->element('genericElements/Form/formLayouts/formRaw', [
'formCreate' => $formCreate,
'ajaxFlashMessage' => $ajaxFlashMessage,
'fieldsString' => $fieldsString,
'formEnd' => $formEnd,
'metaTemplateString' => $metaTemplateString,
]),
'actionButton' => $this->element('genericElements/Form/submitButton', $submitButtonData),
'class' => "modal-lg {$seedModal}"
'size' => !empty($fieldsString) ? 'xl' : 'lg',
'type' => 'confirm',
'modalClass' => $seedModal,
]);
} else if (!empty($raw)) {
echo $this->element('genericElements/Form/formLayouts/formDefault', [