From ff62b5fc0b765c4bf29b79f421983809f4f2675f Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Fri, 14 Apr 2023 11:27:06 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B05888=20-=20Use=20spinner=20for=20modal?= =?UTF-8?q?=20template=20and=20regular=20loader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/Application/WebPage/iTopWebPage.php | 22 +++++++++++++++++++ .../backoffice/itopwebpage/layout.html.twig | 10 --------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/sources/Application/WebPage/iTopWebPage.php b/sources/Application/WebPage/iTopWebPage.php index ee41131fa..53be1340b 100644 --- a/sources/Application/WebPage/iTopWebPage.php +++ b/sources/Application/WebPage/iTopWebPage.php @@ -10,6 +10,7 @@ use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Breadcrumbs\Breadcrumbs; use Combodo\iTop\Application\UI\Base\Component\Modal\DoNotShowAgainOptionBlock; use Combodo\iTop\Application\UI\Base\Component\Panel\PanelUIBlockFactory; +use Combodo\iTop\Application\UI\Base\Component\Spinner\SpinnerUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Template\TemplateUIBlockFactory; use Combodo\iTop\Application\UI\Base\iUIBlock; use Combodo\iTop\Application\UI\Base\Layout\iUIContentBlock; @@ -904,6 +905,27 @@ HTML; $aData['aDeferredBlocks']['oPageContent'] = $this->GetDeferredBlocks($this->GetContentLayout()); // - Prepare generic templates $aData['aTemplates'] = array(); + + // TODO 3.1 Replace hardcoded 'Please wait' with dict entries + + // - Modal template with loader + $oModalTemplateContentBlock = new UIContentBlock(); + $oModalTemplateContentBlock->AddCSSClass('ibo-modal') + ->AddDataAttribute('role', 'ibo-modal') + ->AddSubBlock(SpinnerUIBlockFactory::MakeMedium(null, 'Please wait')); + $aData['aTemplates'][] = TemplateUIBlockFactory::MakeForBlock('ibo-modal-template', $oModalTemplateContentBlock); + + // - Small loader template + $oSmallLoaderTemplateContentBlock = new UIContentBlock(); + $oSmallLoaderTemplateContentBlock->AddSubBlock(SpinnerUIBlockFactory::MakeSmall(null , 'Please wait')); + $aData['aTemplates'][] = TemplateUIBlockFactory::MakeForBlock('ibo-small-loading-placeholder-template', $oSmallLoaderTemplateContentBlock); + + // - Large loader template + $oLargeLoaderTemplateContentBlock = new UIContentBlock(); + $oLargeLoaderTemplateContentBlock->AddSubBlock(SpinnerUIBlockFactory::MakeLarge(null , 'Please wait')); + $aData['aTemplates'][] = TemplateUIBlockFactory::MakeForBlock('ibo-large-loading-placeholder-template', $oLargeLoaderTemplateContentBlock); + + // - Do not show again template $aData['aTemplates'][] = TemplateUIBlockFactory::MakeForBlock('ibo-modal-option--do-not-show-again-template', new DoNotShowAgainOptionBlock()); // - Retrieve layouts linked files diff --git a/templates/pages/backoffice/itopwebpage/layout.html.twig b/templates/pages/backoffice/itopwebpage/layout.html.twig index 1d06dfbf8..b5adc4494 100644 --- a/templates/pages/backoffice/itopwebpage/layout.html.twig +++ b/templates/pages/backoffice/itopwebpage/layout.html.twig @@ -36,16 +36,6 @@ {% endblock %} {% block iboPageTemplates %} - - - - {# Templates #} {% for oTemplate in aTemplates %} {{ render_block(oTemplate, {aPage: aPage}) }}