diff --git a/application/datamodel.application.xml b/application/datamodel.application.xml index dd43a11eb..dcd93fecf 100644 --- a/application/datamodel.application.xml +++ b/application/datamodel.application.xml @@ -853,7 +853,143 @@ Call $this->AddInitialAttributeFlags($sAttCode, $iFlags) for all the initial att - + + Dashlet + + + + + + + + + + + + {{query.selected_class}} + + + + + + + + + + + + + + + + + + {{query.selected_class}} + + + + {{aggregation_function.value != 'count'}} + {{query.selected_class}} + numeric + + + + + + + + + + + + + + + {{order_by.value = 'function'}} + + + + + + + + + + + + + + + + + Dashlet + + + + + + + + + + + + {{query.selected_class}} + + + + + + + + + + + + + + + + + + {{query.selected_class}} + + + + {{aggregation_function.value != 'count'}} + {{query.selected_class}} + numeric + + + + + + + + + + + + + + + {{order_by.value = 'function'}} + + + + + + + + + + + + + + + + Dashlet diff --git a/js/forms/turbo_stream_event_element.js b/js/forms/turbo_stream_event_element.js index d440b39e6..a20996752 100644 --- a/js/forms/turbo_stream_event_element.js +++ b/js/forms/turbo_stream_event_element.js @@ -20,6 +20,8 @@ class TurboStreamEvent extends HTMLElement { }, }); + console.log(event); + document.dispatchEvent(event); } diff --git a/sources/Controller/Base/Layout/DashboardController.php b/sources/Controller/Base/Layout/DashboardController.php index 4b8b6ef54..c3660726a 100644 --- a/sources/Controller/Base/Layout/DashboardController.php +++ b/sources/Controller/Base/Layout/DashboardController.php @@ -2,18 +2,21 @@ namespace Combodo\iTop\Controller\Base\Layout; - +use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Dashlet\DashletWrapper; +use Combodo\iTop\Application\UI\Base\Component\TurboForm\TurboFormUIBlockFactory; use Combodo\iTop\Application\UI\Base\iUIBlock; use Combodo\iTop\Application\WebPage\AjaxPage; use Combodo\iTop\Controller\AbstractController; use ModelReflectionRuntime; use utils; -class DashboardController extends AbstractController { +class DashboardController extends AbstractController +{ public const ROUTE_NAMESPACE = 'dashboard'; - public function OperationNewDashlet (){ + public function OperationNewDashlet() + { $sDashletClass = utils::ReadParam('dashlet_class', '', false, utils::ENUM_SANITIZATION_FILTER_PHP_CLASS); $sDashletId = utils::ReadParam('dashlet_id', '', false, utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER); $oPage = new AjaxPage(''); @@ -27,30 +30,26 @@ class DashboardController extends AbstractController { $oDashletBlock = $oDashlet->DoRender($oPage, true /* bEditMode */, false /* bEnclosingDiv */); //$sHtml = addslashes($oPage->end_capture($offset)); - if($oDashletBlock instanceof iUIBlock) { + if ($oDashletBlock instanceof iUIBlock) { // Wrap the dashlet $oDashletWrapper = new DashletWrapper($oDashletBlock, $oDashlet->GetID(), $sDashletClass); $oPage->AddUiBlock($oDashletWrapper); } } + return $oPage; } - public function OperationGetDashletForm() { - + public function OperationGetDashletForm() + { $sDashletClass = utils::ReadParam('dashlet_class', '', false, utils::ENUM_SANITIZATION_FILTER_PHP_CLASS); $oPage = new AjaxPage(''); - if (is_subclass_of($sDashletClass, 'Dashlet')) { - $oDashlet = new $sDashletClass(new ModelReflectionRuntime(), uniqid()); - $oForm = $oDashlet->GetForm(); // Rebuild the form since the values/content changed - $oForm->SetSubmitParams(utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php', ['operation' => 'update_dashlet_property']); + $oUIBlock = TurboFormUIBlockFactory::MakeForDashletConfiguration($sDashletClass); + $oUIBlock->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction('Confirm', 'dashboard_submit', 'dashboard_submit', true)); + $oUIBlock->AddSubBlock(ButtonUIBlockFactory::MakeForSecondaryAction('Cancel', 'dashboard_cancel')); + $oPage->AddUiBlock($oUIBlock); - $oForm->Render($oPage); - } return $oPage; -// $oForm = $oDashlet->GetForm(); // Rebuild the form since the values/content changed -// ... -// $oPage->AddUiBlock($oFormBlock); } } diff --git a/templates/base/components/turbo-form/layout.html.twig b/templates/base/components/turbo-form/layout.html.twig index ed8c462b1..62d52eaa1 100644 --- a/templates/base/components/turbo-form/layout.html.twig +++ b/templates/base/components/turbo-form/layout.html.twig @@ -1,11 +1,7 @@ {# @copyright Copyright (C) 2010-2025 Combodo SAS #} {# @license http://opensource.org/licenses/AGPL-3.0 #} - {% if oUIBlock.GetAction() %} diff --git a/templates/pages/backoffice/itopwebpage/layout.html.twig b/templates/pages/backoffice/itopwebpage/layout.html.twig index a090bd807..780f7b5ed 100644 --- a/templates/pages/backoffice/itopwebpage/layout.html.twig +++ b/templates/pages/backoffice/itopwebpage/layout.html.twig @@ -2,6 +2,13 @@ {# @license http://opensource.org/licenses/AGPL-3.0 #} {% extends "pages/backoffice/nicewebpage/layout.html.twig" %} {% block iboPageBodyHtml %} + + {# TODO 3.3 voir comment injecter propremrent #} + + {{ render_block(aLayouts.oNavigationMenu, {aPage: aPage}) }}