diff --git a/test/VisualTest/Backoffice/RenderAllUiBlocks.php b/test/VisualTest/Backoffice/RenderAllUiBlocks.php index 080e7dc18..2e1f74495 100644 --- a/test/VisualTest/Backoffice/RenderAllUiBlocks.php +++ b/test/VisualTest/Backoffice/RenderAllUiBlocks.php @@ -28,12 +28,21 @@ use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroup; use Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroupUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\CollapsibleSection\CollapsibleSection; +use Combodo\iTop\Application\UI\Base\Component\Dashlet\DashletBadge; +use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTable; +use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableUIBlockFactory; +use Combodo\iTop\Application\UI\Base\Component\Field\FieldUIBlockFactory; +use Combodo\iTop\Application\UI\Base\Component\FieldSet\FieldSet; use Combodo\iTop\Application\UI\Base\Component\Html\Html; +use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Panel\Panel; use Combodo\iTop\Application\UI\Base\Component\Panel\PanelUIBlockFactory; +use Combodo\iTop\Application\UI\Base\Component\Pill\PillFactory; use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu; +use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory; use Combodo\iTop\Application\UI\Base\Layout\Object\ObjectFactory; use Combodo\iTop\Application\UI\Base\Layout\PageContent\PageContentFactory; +use Combodo\iTop\Application\UI\Base\Layout\UIContentBlockWithJSRefreshCallback; use iTopWebPage; use LoginWebPage; use MetaModel; @@ -48,18 +57,8 @@ $oPageContentLayout = PageContentFactory::MakeStandardEmpty(); $oPage->SetContentLayout($oPageContentLayout); $oPage->add_style(<<AddMainBlock(new Html('
')); ///////// // Alerts ///////// -$oAlertsTitle = new Html('

Alerts examples

'); -$oPage->AddUiBlock($oAlertsTitle); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Alerts examples', 2, 'title-alert')); $sContent = <<The content text is made of raw HTML, therefore it must be sanitized before being injected into the component.
Here we put an hyperlink (link) and a smiley (😻), just to see if it renders correctly
@@ -103,8 +101,7 @@ $oPageContentLayout->AddMainBlock(new Html('
')); ////////// // Buttons ////////// -$oButtonsJSTitle = new Html('

ButtonsJS examples

'); -$oPage->AddUiBlock($oButtonsJSTitle); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('ButtonsJS examples', 2, 'title-buttonsjs')); $oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeNeutral('Neutral')); $oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeNeutral('Neutral dis.', 'neutral')->SetIsDisabled(true)); $oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForPrimaryAction('Primary')); @@ -126,8 +123,7 @@ $oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForAlternativeValida $oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForAlternativeDestructiveAction('Alt. destructive')); $oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeForAlternativeDestructiveAction('Alt. destructive dis.')->SetIsDisabled(true)); -$oButtonsURLTitle = new Html('

ButtonsURL examples

'); -$oPage->AddUiBlock($oButtonsURLTitle); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('ButtonsURL examples', 2, 'title-buttonsurl')); $oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeLinkNeutral('#', 'Link neutral')); $oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeIconLink('fas fa-thumbs-up', 'Icon link button', '#')); $oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeLinkNeutral('#', 'Link primary')->SetColor(Button::ENUM_COLOR_SCHEME_PRIMARY)); @@ -139,7 +135,8 @@ $oPageContentLayout->AddMainBlock(new Html('
')); // ButtonGroup ////////////// -$oPage->AddUiBlock(new Html('

ButtonGroups examples: button + menu

')); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('ButtonGroups examples: button + menu', 2, 'title-button-groupsmenu')); + $oPageContentLayout->AddMainBlock(ButtonGroupUIBlockFactory::MakeButtonWithOptionsMenu( ButtonUIBlockFactory::MakeNeutral('Neutral with options'), new PopoverMenu() @@ -181,7 +178,8 @@ $oPageContentLayout->AddMainBlock(ButtonGroupUIBlockFactory::MakeButtonWithOptio new PopoverMenu() )); -$oPage->AddUiBlock(new Html('

ButtonGroups examples: button + button + button

')); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('ButtonGroups examples: button + button + button', 2, 'title-button-groupsh')); + $oPageContentLayout->AddMainBlock(new ButtonGroup( [ ButtonUIBlockFactory::MakeNeutral('Three'), @@ -209,8 +207,8 @@ $oPageContentLayout->AddMainBlock(new Html('
')); ///////// // Panels ///////// -$oPanelsTitle = new Html('

Panels examples

'); -$oPage->AddUiBlock($oPanelsTitle); +/// +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Panels examples', 2, 'title-panels')); $aSubBlocks = [ new Html('
Panel body, can contain anything from simple text to rich text, forms, images, links, graphs or tables.
'), @@ -292,8 +290,7 @@ $oPageContentLayout->AddMainBlock(new Html('
')); ///////// // ObjectDetails ///////// -$oObjecTDetailsTitle = new Html('

ObjectDetails examples

'); -$oPage->AddUiBlock($oObjecTDetailsTitle); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('ObjectDetails examples', 2, 'title-object-details')); $oOrgObject = MetaModel::NewObject('Organization'); $oOrgObject->Set('name', 'Stub, no tab container. Just to see how the header is displayed'); @@ -318,8 +315,7 @@ $oPageContentLayout->AddMainBlock(new Html('
')); ///////// // Collapsible Section ///////// -$oCollapsibleSectionTitle = new Html('

Collapsible Sections examples

'); -$oPage->AddUiBlock($oCollapsibleSectionTitle); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Collapsible Sections examples', 2, 'title-collapsible')); $sSectionContent = 'This is the section content !'; $oCollapsibleSection = new CollapsibleSection('Section title', [new Html($sSectionContent)]); @@ -329,4 +325,88 @@ $oCollapsibleSectionSaveState = new CollapsibleSection('Section save state', [ne $oCollapsibleSectionSaveState->EnableSaveCollapsibleState('RenderAllUiBlocks__section'); $oPage->AddUiBlock($oCollapsibleSectionSaveState); +///////// +// Fieldset +///////// + +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Fieldset/field examples', 2)); + + +$oDashletFieldset1 = new FieldSet('Fieldset 1'); +$oDashletField1 = FieldUIBlockFactory::MakeStandard('Field A'); +$oDashletInput1 = InputUIBlockFactory::MakeStandard('text', 'input1', 'Input 1'); +$oDashletField2 = FieldUIBlockFactory::MakeStandard('Field B'); +$oDashletInput2 = InputUIBlockFactory::MakeStandard('text', 'input2', 'Input 2'); +$oDashletField3 = FieldUIBlockFactory::MakeStandard('Field C'); +$oDashletInput3 = InputUIBlockFactory::MakeStandard('text', 'input3', 'Input 3'); +$oDashletFieldset2 = new FieldSet('Fieldset 2'); +$oDashletField4 = FieldUIBlockFactory::MakeStandard('Field D'); +$oDashletField5 = FieldUIBlockFactory::MakeStandard('Field E'); +$oDashletField6 = FieldUIBlockFactory::MakeStandard('Field F'); +$oPage->AddUiBlock($oDashletFieldset1); +$oPage->AddUiBlock($oDashletFieldset2); +$oDashletFieldset1->AddSubBlock($oDashletField1); +$oDashletFieldset1->AddSubBlock($oDashletInput1); +$oDashletFieldset1->AddSubBlock($oDashletField2); +$oDashletFieldset1->AddSubBlock($oDashletInput2); +$oDashletFieldset1->AddSubBlock($oDashletField3); +$oDashletFieldset1->AddSubBlock($oDashletInput3); +$oDashletFieldset2->AddSubBlock($oDashletField4); +$oDashletFieldset2->AddSubBlock($oDashletField5); +$oDashletFieldset2->AddSubBlock($oDashletField6); + +///////// +// Pill +///////// + +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Pill examples', 2 )); + +$oBlock = new UIContentBlockWithJSRefreshCallback(null, ["ibo-dashlet-header-dynamic--container"]); +$oPage->AddUiBlock($oBlock); +$oPill1 = PillFactory::MakeForState('Person', 'active')->AddHtml("8active"); +$oPill2 = PillFactory::MakeForState('Person', 'inactive')->AddHtml("8inactive"); +$oPill3 = PillFactory::MakeForState('Person', 'closed')->AddHtml("8closed"); +$oPill4 = PillFactory::MakeForState('Person', 'new')->AddHtml("8new"); +$oPill5 = PillFactory::MakeForState('Person', 'waiting')->AddHtml("8waiting"); +$oPill6 = PillFactory::MakeForState('Person', 'escalated')->AddHtml("8escalated"); +$oBlock->AddSubBlock($oPill1); +$oBlock->AddSubBlock($oPill2); +$oBlock->AddSubBlock($oPill3); +$oBlock->AddSubBlock($oPill4); +$oBlock->AddSubBlock($oPill5); +$oBlock->AddSubBlock($oPill6); + +///////// +// Title +///////// + +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title examples', 2 )); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 1', 1 )); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 2', 2 )); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 3', 3 )); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 4', 4 )); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 5', 5 )); + +///////// +// DataTable +///////// +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Datatable examples', 2 )); + +$oPage->AddUiBlock(DataTableUIBlockFactory::MakeForStaticData('Static datatable', + array( + 'a' => array('label' => 'a'), + 'b' => array('label' => 'b'), + 'c' => array('label' => 'c'), + 'd' => array('label' => 'd') + ), + array( + array( + 'a' => 'A1', 'b' => 'B1', 'c' => 'C1', 'd' => 'D1' +),array( + 'a' => 'A2', 'b' => 'B2', 'c' => 'C2', 'd' => 'D2' +), + array( + 'a' => 'A3', 'b' => 'B3', 'c' => 'C3', 'd' => 'D3' + )))); + $oPage->output();