mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Alert component : allow to be closed by default
This commit is contained in:
@@ -84,6 +84,8 @@ class Alert extends UIBlock
|
||||
protected $sContent;
|
||||
/** @var string $sColor */
|
||||
protected $sColor;
|
||||
/** @var bool */
|
||||
protected $bIsOpenedByDefault;
|
||||
|
||||
/**
|
||||
* Alert constructor.
|
||||
@@ -92,12 +94,16 @@ class Alert extends UIBlock
|
||||
* @param string $sContent
|
||||
* @param string $sColor
|
||||
* @param string|null $sId
|
||||
* @param bool|null $bIsOpenedByDefault
|
||||
*/
|
||||
public function __construct(string $sTitle = '', string $sContent = '', string $sColor = self::DEFAULT_COLOR, ?string $sId = null)
|
||||
public function __construct(string $sTitle = '', string $sContent = '', string $sColor = self::DEFAULT_COLOR, ?string $sId = null,
|
||||
?bool $bIsOpenedByDefault = true
|
||||
)
|
||||
{
|
||||
$this->sTitle = $sTitle;
|
||||
$this->sContent = $sContent;
|
||||
$this->sColor = $sColor;
|
||||
$this->bIsOpenedByDefault = $bIsOpenedByDefault;
|
||||
parent::__construct($sId);
|
||||
}
|
||||
|
||||
@@ -148,7 +154,7 @@ class Alert extends UIBlock
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetColor()
|
||||
public function GetColor(): string
|
||||
{
|
||||
return $this->sColor;
|
||||
}
|
||||
@@ -163,4 +169,16 @@ class Alert extends UIBlock
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function IsOpenedByDefault()
|
||||
{
|
||||
return $this->bIsOpenedByDefault;
|
||||
}
|
||||
|
||||
public function SetOpenedByDefault(bool $bIsOpenedByDefault): Alert
|
||||
{
|
||||
$this->bIsOpenedByDefault = $bIsOpenedByDefault;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<div id="{{ oUIBlock.GetId() }}" class="ibo-alert ibo-is-{{ oUIBlock.GetColor() }} ibo-is-opened">
|
||||
<div id="{{ oUIBlock.GetId() }}" class="ibo-alert ibo-is-{{ oUIBlock.GetColor() }}{% if oUIBlock.IsOpenedByDefault() %} ibo-is-opened"{% endif %}>
|
||||
<div class="ibo-alert--action-button ibo-alert--maximize-button" data-role="ibo-alert--maximize-button"><i class="fas fa-caret-down"></i></div>
|
||||
<div class="ibo-alert--action-button ibo-alert--minimize-button" data-role="ibo-alert--minimize-button"><i class="fas fa-caret-up"></i></div>
|
||||
<div class="ibo-alert--action-button ibo-alert--close-button" data-role="ibo-alert--close-button"><i class="fas fa-times"></i></div>
|
||||
|
||||
Reference in New Issue
Block a user