chg: [requestProcessor:localTool] Extendable view with specific local tool action templates
parent
304a6ea169
commit
49a4c37eb6
|
@ -66,8 +66,9 @@ class GenericRequestProcessor
|
|||
|
||||
public function render($request=[], Cake\Http\ServerRequest $serverRequest)
|
||||
{
|
||||
$processingTemplate = $this->getProcessingTemplate();
|
||||
$viewVariables = $this->getViewVariables($request);
|
||||
$this->updateProcessingTemplate($request);
|
||||
$processingTemplate = $this->getProcessingTemplate();
|
||||
$builder = new ViewBuilder();
|
||||
$builder->disableAutoLayout()
|
||||
->setClassName('Monad')
|
||||
|
|
|
@ -31,8 +31,9 @@ class LocalToolRequestProcessor extends GenericRequestProcessor
|
|||
return parent::create($requestData);
|
||||
}
|
||||
|
||||
protected function assignProcessingTemplate($connectorName)
|
||||
protected function updateProcessingTemplate($request)
|
||||
{
|
||||
$connectorName = $request->connector['connector'];
|
||||
$processingTemplatePath = sprintf('%s/%s/%s.php', $this->scope, $connectorName, $this->action);
|
||||
$file = new File($this->processingTemplatesDirectory . DS . $processingTemplatePath);
|
||||
if ($file->exists()) {
|
||||
|
|
|
@ -91,18 +91,13 @@ $form = $this->element('genericElements/Form/genericForm', [
|
|||
'raw' => true,
|
||||
'data' => [
|
||||
'model' => 'Inbox',
|
||||
'fields' => [
|
||||
[
|
||||
'field' => 'is_discard',
|
||||
'type' => 'checkbox',
|
||||
'default' => false
|
||||
]
|
||||
],
|
||||
'fields' => [],
|
||||
'submit' => [
|
||||
'action' => $this->request->getParam('action')
|
||||
]
|
||||
]
|
||||
]);
|
||||
$localToolHTML = $this->fetch('content', sprintf('<div class="d-none">%s</div>', $form));
|
||||
|
||||
$requestData = $this->Bootstrap->collapse(
|
||||
[
|
||||
|
@ -112,10 +107,10 @@ $requestData = $this->Bootstrap->collapse(
|
|||
sprintf('<pre class="p-2 rounded mb-0" style="background: #eeeeee55;"><code>%s</code></pre>', json_encode($request['data'], JSON_PRETTY_PRINT))
|
||||
);
|
||||
|
||||
$bodyHtml = sprintf('<div class="py-2"><div>%s</div>%s</div><div class="d-none">%s</div>',
|
||||
$bodyHtml = sprintf('<div class="py-2"><div>%s</div>%s</div>%s',
|
||||
$table,
|
||||
$requestData,
|
||||
$form
|
||||
$localToolHTML
|
||||
);
|
||||
|
||||
echo $this->Bootstrap->modal([
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
$this->extend('LocalTool/GenericRequest');
|
||||
$form = $this->element('genericElements/Form/genericForm', [
|
||||
'entity' => null,
|
||||
'ajax' => false,
|
||||
'raw' => true,
|
||||
'data' => [
|
||||
'model' => 'Inbox',
|
||||
'fields' => [
|
||||
[
|
||||
'field' => 'is_discard',
|
||||
'type' => 'checkbox',
|
||||
'default' => false
|
||||
]
|
||||
],
|
||||
'submit' => [
|
||||
'action' => $this->request->getParam('action')
|
||||
]
|
||||
]
|
||||
]);
|
||||
echo sprintf('<div class="d-none">%s</div>', $form);
|
Loading…
Reference in New Issue