dashboard editor

This commit is contained in:
Benjamin Dalsass
2025-12-22 07:53:09 +01:00
parent fb3cbcd779
commit 0dc32b3b13
6 changed files with 10 additions and 2 deletions

View File

@@ -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,

View File

@@ -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));
}

View File

@@ -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());

View File

@@ -138,3 +138,4 @@
</button>
</div>
{%- endblock oql_form_row -%}

View File

@@ -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 %}

View File

@@ -0,0 +1,5 @@
{%- block dashlet_collection_row -%}
{{- form_errors(form) -}}
{{- form_label(form) -}}
<div class="dashlets-container"></div>
{%- endblock dashlet_collection_row -%}