mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
dashboard editor
This commit is contained in:
@@ -13,6 +13,7 @@ class TurboStreamEvent extends HTMLElement {
|
|||||||
const event = new CustomEvent("itop:TurboStreamEvent", {
|
const event = new CustomEvent("itop:TurboStreamEvent", {
|
||||||
detail: {
|
detail: {
|
||||||
id: this.getAttribute('id'),
|
id: this.getAttribute('id'),
|
||||||
|
form_id: this.dataset.formId,
|
||||||
block_class: this.dataset.formBlockClass,
|
block_class: this.dataset.formBlockClass,
|
||||||
view_data: this.dataset.viewData,
|
view_data: this.dataset.viewData,
|
||||||
valid: this.dataset.valid,
|
valid: this.dataset.valid,
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ abstract class AbstractExpressionFormBlock extends AbstractFormBlock
|
|||||||
try {
|
try {
|
||||||
$oExpression = Expression::FromOQL($sExpression);
|
$oExpression = Expression::FromOQL($sExpression);
|
||||||
$aFieldsToResolve = $oExpression->ListRequiredFields();
|
$aFieldsToResolve = $oExpression->ListRequiredFields();
|
||||||
|
$aResolvedParams = [];
|
||||||
foreach ($aFieldsToResolve as $sFieldToResolve) {
|
foreach ($aFieldsToResolve as $sFieldToResolve) {
|
||||||
$aResolvedParams[$sFieldToResolve] = strval($this->GetInputValue($sFieldToResolve));
|
$aResolvedParams[$sFieldToResolve] = strval($this->GetInputValue($sFieldToResolve));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class BlockRenderer
|
|||||||
$aAdditionalPaths[] = APPROOT.'lib/symfony/twig-bridge/Resources/views/Form';
|
$aAdditionalPaths[] = APPROOT.'lib/symfony/twig-bridge/Resources/views/Form';
|
||||||
$oTwig = TwigHelper::GetTwigEnvironment(static::TWIG_BASE_PATH, $aAdditionalPaths);
|
$oTwig = TwigHelper::GetTwigEnvironment(static::TWIG_BASE_PATH, $aAdditionalPaths);
|
||||||
/** @link https://github.com/symfony/twig-bridge/blob/6.4/CHANGELOG.md#320 */
|
/** @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([
|
$oTwig->addRuntimeLoader(new FactoryRuntimeLoader([
|
||||||
FormRenderer::class => function () use ($formEngine): FormRenderer {
|
FormRenderer::class => function () use ($formEngine): FormRenderer {
|
||||||
return new FormRenderer($formEngine, new CsrfTokenManager());
|
return new FormRenderer($formEngine, new CsrfTokenManager());
|
||||||
|
|||||||
@@ -138,3 +138,4 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{%- endblock oql_form_row -%}
|
{%- endblock oql_form_row -%}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,6 @@
|
|||||||
{% if current_form %}
|
{% if current_form %}
|
||||||
{% UITurboStream Replace { sTarget: current_form.vars.id} %}
|
{% UITurboStream Replace { sTarget: current_form.vars.id} %}
|
||||||
{{ form_widget(current_form) }}
|
{{ 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 %}
|
{% EndUITurboStream %}
|
||||||
{% endif %}
|
{% 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