mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-01 07:04:16 +01:00
dashboard editor
This commit is contained in:
@@ -13,6 +13,7 @@ class TurboStreamEvent extends HTMLElement {
|
||||
const event = new CustomEvent("itop:TurboStreamEvent", {
|
||||
detail: {
|
||||
id: this.getAttribute('id'),
|
||||
form_id: this.dataset.formId,
|
||||
block_class: this.dataset.formBlockClass,
|
||||
view_data: this.dataset.viewData,
|
||||
valid: this.dataset.valid,
|
||||
|
||||
@@ -49,6 +49,7 @@ abstract class AbstractExpressionFormBlock extends AbstractFormBlock
|
||||
try {
|
||||
$oExpression = Expression::FromOQL($sExpression);
|
||||
$aFieldsToResolve = $oExpression->ListRequiredFields();
|
||||
$aResolvedParams = [];
|
||||
foreach ($aFieldsToResolve as $sFieldToResolve) {
|
||||
$aResolvedParams[$sFieldToResolve] = strval($this->GetInputValue($sFieldToResolve));
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class BlockRenderer
|
||||
$aAdditionalPaths[] = APPROOT.'lib/symfony/twig-bridge/Resources/views/Form';
|
||||
$oTwig = TwigHelper::GetTwigEnvironment(static::TWIG_BASE_PATH, $aAdditionalPaths);
|
||||
/** @link https://github.com/symfony/twig-bridge/blob/6.4/CHANGELOG.md#320 */
|
||||
$formEngine = new TwigRendererEngine(['application/forms/itop_console_layout.html.twig'], $oTwig);
|
||||
$formEngine = new TwigRendererEngine(['application/forms/itop_console_layout.html.twig', 'application/forms/wip_form_demonstrator.html.twig'], $oTwig);
|
||||
$oTwig->addRuntimeLoader(new FactoryRuntimeLoader([
|
||||
FormRenderer::class => function () use ($formEngine): FormRenderer {
|
||||
return new FormRenderer($formEngine, new CsrfTokenManager());
|
||||
|
||||
@@ -138,3 +138,4 @@
|
||||
</button>
|
||||
</div>
|
||||
{%- endblock oql_form_row -%}
|
||||
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
{% if current_form %}
|
||||
{% UITurboStream Replace { sTarget: current_form.vars.id} %}
|
||||
{{ form_widget(current_form) }}
|
||||
<turbo-stream-event id="{{ current_form.vars.id }}-turbo-stream-event" data-form-block-class="{{ current_form.vars.form_block_class }}" data-view-data="{{ current_form.vars.value|json_encode }}" data-valid="{{ current_form.vars.valid }}"/>
|
||||
<turbo-stream-event id="{{ current_form.vars.id }}-turbo-stream-event" data-form-id="{{ current_form.vars.id }}" data-form-block-class="{{ current_form.vars.form_block_class }}" data-view-data="{{ current_form.vars.value|json_encode }}" data-valid="{{ current_form.vars.valid }}"/>
|
||||
{% EndUITurboStream %}
|
||||
{% endif %}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{%- block dashlet_collection_row -%}
|
||||
{{- form_errors(form) -}}
|
||||
{{- form_label(form) -}}
|
||||
<div class="dashlets-container"></div>
|
||||
{%- endblock dashlet_collection_row -%}
|
||||
Reference in New Issue
Block a user