diff --git a/css/backoffice/components/_datatable.scss b/css/backoffice/components/_datatable.scss index b2dff080e..c77ad2fb5 100644 --- a/css/backoffice/components/_datatable.scss +++ b/css/backoffice/components/_datatable.scss @@ -8,6 +8,7 @@ $ibo-datatable--toolbar--padding-y: 0 !default; $ibo-datatable--toolbar--text-color: $ibo-color-grey-700 !default; $ibo-datatable--toolbar--elements-spacing: 1rem !default; $ibo-datatable--toolbar--table-spacing: 18px !default; +$ibo-datatable-panel--table-spacing: 48px !default; $ibo-datatable-panel--body--padding: $ibo-panel--body--padding-top 0px $ibo-panel--body--padding-bottom !default; $ibo-datatable--selection-validation-buttons-toolbar--margin-top: 10px !default; @@ -47,15 +48,27 @@ $ibo-list-column--max-height: 150px; padding: $ibo-datatable-panel--body--padding; } +.ibo-datatable-panel { + /* Above the table */ + &:first-child { + margin-bottom: $ibo-datatable-panel--table-spacing; + } + + /* below the table */ + &:not(:first-child) { + margin-top: $ibo-datatable-panel--table-spacing; + } +} + // For cancel / OK / next... selection validation buttons .ibo-datatable--selection-validation-buttons-toolbar { - clear: both; - margin-top: $ibo-datatable--selection-validation-buttons-toolbar--margin-top; + clear: both; + margin-top: $ibo-datatable--selection-validation-buttons-toolbar--margin-top; } .ibo-list-column { - max-height: $ibo-list-column--max-height; - overflow-y: auto; + max-height: $ibo-list-column--max-height; + overflow-y: auto; } .ibo-datatable .ibo-field-badge { diff --git a/css/backoffice/utils/helpers/_all.scss b/css/backoffice/utils/helpers/_all.scss index 2c5d83b73..8a957b9a6 100644 --- a/css/backoffice/utils/helpers/_all.scss +++ b/css/backoffice/utils/helpers/_all.scss @@ -20,4 +20,5 @@ @import "depression"; @import "elevation"; @import "misc"; -@import "font-icon"; \ No newline at end of file +@import "font-icon"; +@import "color"; \ No newline at end of file diff --git a/css/backoffice/utils/helpers/_color.scss b/css/backoffice/utils/helpers/_color.scss new file mode 100644 index 000000000..28a22aca8 --- /dev/null +++ b/css/backoffice/utils/helpers/_color.scss @@ -0,0 +1,42 @@ +/*! + * Copyright (C) 2013-2021 Combodo SARL + * + * This file is part of iTop. + * + * iTop is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * iTop is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + */ + +$ibo-text-colors: ( + 'primary': $ibo-color-primary-800, + 'secondary': $ibo-color-secondary-800, + 'neutral': $ibo-color-secondary-800, + 'information': $ibo-color-information-800, + 'success': $ibo-color-success-800, + 'failure': $ibo-color-danger-800, + 'warning': $ibo-color-warning-800, + 'danger': $ibo-color-danger-800, + 'grey' : $ibo-color-grey-800, + 'blue-grey': $ibo-color-blue-grey-800, + 'blue': $ibo-color-blue-800, + 'cyan': $ibo-color-cyan-800, + 'green': $ibo-color-green-800, + 'orange': $ibo-color-orange-800, + 'red': $ibo-color-red-800, + 'pink': $ibo-color-pink-800, +) !default; + +@each $sColor, $sColorValue in $ibo-text-colors { + .ibo-text.ibo-is-#{$sColor} { + color: $sColorValue; + } +} \ No newline at end of file diff --git a/sources/application/TwigBase/Controller/Controller.php b/sources/application/TwigBase/Controller/Controller.php index 7b348194a..7a4cafab9 100644 --- a/sources/application/TwigBase/Controller/Controller.php +++ b/sources/application/TwigBase/Controller/Controller.php @@ -367,8 +367,7 @@ abstract class Controller */ public function DisplayPage($aParams = array(), $sTemplateName = null, $sPageType = 'html') { - if (empty($sTemplateName)) - { + if (empty($sTemplateName)) { $sTemplateName = $this->m_sOperation; } $aParams = array_merge($this->GetDefaultParameters(), $aParams); @@ -376,25 +375,21 @@ abstract class Controller $this->AddToPage($this->RenderTemplate($aParams, $sTemplateName, 'html')); $this->AddScriptToPage($this->RenderTemplate($aParams, $sTemplateName, 'js')); $this->AddReadyScriptToPage($this->RenderTemplate($aParams, $sTemplateName, 'ready.js')); - if (!empty($this->m_aAjaxTabs)) - { + $this->AddStyleToPage($this->RenderTemplate($aParams, $sTemplateName, 'css')); + if (!empty($this->m_aAjaxTabs)) { $this->m_oPage->AddTabContainer(''); $this->m_oPage->SetCurrentTabContainer(''); } - foreach ($this->m_aAjaxTabs as $sTabCode => $aTabData) - { + foreach ($this->m_aAjaxTabs as $sTabCode => $aTabData) { $this->AddAjaxTabToPage($sTabCode, $aTabData['label'], $aTabData['url'], $aTabData['cache']); } - foreach ($this->m_aLinkedScripts as $sLinkedScript) - { + foreach ($this->m_aLinkedScripts as $sLinkedScript) { $this->AddLinkedScriptToPage($sLinkedScript); } - foreach ($this->m_aLinkedStylesheets as $sLinkedStylesheet) - { + foreach ($this->m_aLinkedStylesheets as $sLinkedStylesheet) { $this->AddLinkedStylesheetToPage($sLinkedStylesheet); } - foreach ($this->m_aSaas as $sSaasRelPath) - { + foreach ($this->m_aSaas as $sSaasRelPath) { $this->AddSaasToPage($sSaasRelPath); } $this->OutputPage(); @@ -432,8 +427,7 @@ abstract class Controller */ public function DownloadZippedPage($aParams = array(), $sTemplateName = null) { - if (empty($sTemplateName)) - { + if (empty($sTemplateName)) { $sTemplateName = $this->m_sOperation; } $sReportFolder = str_replace("\\", '/', APPROOT.'log/'); @@ -441,7 +435,10 @@ abstract class Controller $sHTMLReport = $sReportFolder.$sReportFile.'.html'; $sZIPReportFile = $sReportFile; - file_put_contents($sHTMLReport, $this->RenderTemplate($aParams, $sTemplateName, 'html')); + ob_start(); + $this->DisplayPage($aParams, $sTemplateName, self::ENUM_PAGE_TYPE_BASIC_HTML); + file_put_contents($sHTMLReport, ob_get_contents()); + ob_end_clean(); $this->ZipDownloadRemoveFile(array($sHTMLReport), $sZIPReportFile, true); } @@ -658,6 +655,11 @@ abstract class Controller $this->m_oPage->add_linked_stylesheet($sLinkedStylesheet); } + private function AddStyleToPage($sStyle) + { + $this->m_oPage->add_style($sStyle); + } + private function AddSaasToPage($sSaasRelPath) { $this->m_oPage->add_saas($sSaasRelPath); diff --git a/sources/application/UI/Base/Component/Alert/Alert.php b/sources/application/UI/Base/Component/Alert/Alert.php index c1e440699..87c44c182 100644 --- a/sources/application/UI/Base/Component/Alert/Alert.php +++ b/sources/application/UI/Base/Component/Alert/Alert.php @@ -35,7 +35,7 @@ class Alert extends UIContentBlock // Overloaded constants public const BLOCK_CODE = 'ibo-alert'; public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/alert/layout'; - public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/components/alert/layout'; + public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'base/components/alert/layout'; public const DEFAULT_JS_FILES_REL_PATH = [ 'js/components/alert.js', ]; diff --git a/sources/application/UI/Base/Component/Panel/PanelUIBlockFactory.php b/sources/application/UI/Base/Component/Panel/PanelUIBlockFactory.php index b8ebd4a25..823f5898a 100644 --- a/sources/application/UI/Base/Component/Panel/PanelUIBlockFactory.php +++ b/sources/application/UI/Base/Component/Panel/PanelUIBlockFactory.php @@ -42,12 +42,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory * Make a basis Panel component * * @param string $sTitle + * @param string|null $sSubTitle * * @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel */ - public static function MakeNeutral(string $sTitle) + public static function MakeNeutral(string $sTitle, string $sSubTitle = null) { $oPanel = new Panel($sTitle); + if (!is_null($sSubTitle)) { + $oPanel->SetSubTitle($sSubTitle); + } $oPanel->SetColor(Panel::ENUM_COLOR_NEUTRAL); return $oPanel; @@ -57,12 +61,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory * Make a Panel component for informational messages * * @param string $sTitle + * @param string|null $sSubTitle * * @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel */ - public static function MakeForInformation(string $sTitle) + public static function MakeForInformation(string $sTitle, string $sSubTitle = null) { $oPanel = new Panel($sTitle); + if (!is_null($sSubTitle)) { + $oPanel->SetSubTitle($sSubTitle); + } $oPanel->SetColor(Panel::ENUM_COLOR_INFORMATION); return $oPanel; @@ -72,12 +80,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory * Make a Panel component for successful messages * * @param string $sTitle + * @param string|null $sSubTitle * * @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel */ - public static function MakeForSuccess(string $sTitle) + public static function MakeForSuccess(string $sTitle, string $sSubTitle = null) { $oPanel = new Panel($sTitle); + if (!is_null($sSubTitle)) { + $oPanel->SetSubTitle($sSubTitle); + } $oPanel->SetColor(Panel::ENUM_COLOR_SUCCESS); return $oPanel; @@ -87,12 +99,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory * Make a Panel component for warning messages * * @param string $sTitle + * @param string|null $sSubTitle * * @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel */ - public static function MakeForWarning(string $sTitle) + public static function MakeForWarning(string $sTitle, string $sSubTitle = null) { $oPanel = new Panel($sTitle); + if (!is_null($sSubTitle)) { + $oPanel->SetSubTitle($sSubTitle); + } $oPanel->SetColor(Panel::ENUM_COLOR_WARNING); return $oPanel; @@ -102,12 +118,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory * Make a Panel component for danger messages * * @param string $sTitle + * @param string|null $sSubTitle * * @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel */ - public static function MakeForDanger(string $sTitle) + public static function MakeForDanger(string $sTitle, string $sSubTitle = null) { $oPanel = new Panel($sTitle); + if (!is_null($sSubTitle)) { + $oPanel->SetSubTitle($sSubTitle); + } $oPanel->SetColor(Panel::ENUM_COLOR_DANGER); return $oPanel; @@ -117,12 +137,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory * Make a Panel component for failure messages * * @param string $sTitle + * @param string|null $sSubTitle * * @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel */ - public static function MakeForFailure(string $sTitle) + public static function MakeForFailure(string $sTitle, string $sSubTitle = null) { $oPanel = new Panel($sTitle); + if (!is_null($sSubTitle)) { + $oPanel->SetSubTitle($sSubTitle); + } $oPanel->SetColor(Panel::ENUM_COLOR_FAILURE); return $oPanel; @@ -132,12 +156,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory * Make a Panel component with primary color scheme * * @param string $sTitle + * @param string|null $sSubTitle * * @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel */ - public static function MakeWithBrandingPrimaryColor(string $sTitle) + public static function MakeWithBrandingPrimaryColor(string $sTitle, string $sSubTitle = null) { $oPanel = new Panel($sTitle); + if (!is_null($sSubTitle)) { + $oPanel->SetSubTitle($sSubTitle); + } $oPanel->SetColor(Panel::ENUM_COLOR_PRIMARY); return $oPanel; @@ -147,12 +175,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory * Make a Panel component with secondary color scheme * * @param string $sTitle + * @param string|null $sSubTitle * * @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel */ - public static function MakeWithBrandingSecondaryColor(string $sTitle) + public static function MakeWithBrandingSecondaryColor(string $sTitle, string $sSubTitle = null) { $oPanel = new Panel($sTitle); + if (!is_null($sSubTitle)) { + $oPanel->SetSubTitle($sSubTitle); + } $oPanel->SetColor(Panel::ENUM_COLOR_SECONDARY); return $oPanel; @@ -163,12 +195,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory * * @param string $sClass Class of the object the panel is for * @param string $sTitle + * @param string|null $sSubTitle * * @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel */ - public static function MakeForClass(string $sClass, string $sTitle) + public static function MakeForClass(string $sClass, string $sTitle, string $sSubTitle = null) { $oPanel = new Panel($sTitle); + if (!is_null($sSubTitle)) { + $oPanel->SetSubTitle($sSubTitle); + } $oPanel->SetColorFromClass($sClass); return $oPanel; diff --git a/sources/application/UI/Base/Layout/MultiColumn/MultiColumn.php b/sources/application/UI/Base/Layout/MultiColumn/MultiColumn.php index 65edcae34..ff47ca124 100644 --- a/sources/application/UI/Base/Layout/MultiColumn/MultiColumn.php +++ b/sources/application/UI/Base/Layout/MultiColumn/MultiColumn.php @@ -8,7 +8,7 @@ namespace Combodo\iTop\Application\UI\Base\Layout\MultiColumn; use Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column\Column; -use Combodo\iTop\Application\UI\Base\UIBlock; +use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock; /** * Class MultiColumn @@ -17,20 +17,18 @@ use Combodo\iTop\Application\UI\Base\UIBlock; * @internal * @since 3.0.0 */ -class MultiColumn extends UIBlock { +class MultiColumn extends UIContentBlock +{ // Overloaded constants public const BLOCK_CODE = 'ibo-multi-column'; public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/multi-column/layout'; - /** @var \Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column\Column[] */ - protected $aColumns; - /** * @inheritDoc */ - public function __construct(?string $sId = null) { + public function __construct(?string $sId = null) + { parent::__construct($sId); - $this->aColumns = []; } /** @@ -38,32 +36,10 @@ class MultiColumn extends UIBlock { * * @return $this */ - public function AddColumn(Column $oColumn) { - $this->aColumns[] = $oColumn; + public function AddColumn(Column $oColumn) + { + $this->AddSubBlock($oColumn); return $this; } - - /** - * Remove the column of $iIndex index. - * Note that if the column does not exists, it proceeds silently. - * - * @param int $iIndex - * - * @return $this - */ - public function RemoveColumn(int $iIndex) { - if (isset($this->aColumns[$iIndex])) { - unset($this->aColumns[$iIndex]); - } - - return $this; - } - - /** - * @inheritDoc - */ - public function GetSubBlocks() { - return $this->aColumns; - } } \ No newline at end of file diff --git a/templates/base/components/alert/layout.js.twig b/templates/base/components/alert/layout.ready.js.twig similarity index 100% rename from templates/base/components/alert/layout.js.twig rename to templates/base/components/alert/layout.ready.js.twig diff --git a/templates/base/components/spinner/layout.html.twig b/templates/base/components/spinner/layout.html.twig index 3d03246bd..69c1dc583 100644 --- a/templates/base/components/spinner/layout.html.twig +++ b/templates/base/components/spinner/layout.html.twig @@ -1,5 +1,5 @@ {# @copyright Copyright (C) 2010-2021 Combodo SARL #} {# @license http://opensource.org/licenses/AGPL-3.0 #} {% apply spaceless %} - + {% endapply %} \ No newline at end of file