mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°3581 - Dashlet: Fix pill not being completely clickable
This commit is contained in:
@@ -20,13 +20,25 @@ use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
*/
|
||||
class Pill extends UIContentBlock
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-pill';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/pill/layout';
|
||||
|
||||
/** @var string */
|
||||
protected $sColor;
|
||||
/** @var string URL to go to if the pill is clicked */
|
||||
protected $sUrl;
|
||||
|
||||
/**
|
||||
* Pill constructor.
|
||||
*
|
||||
* @param string $sColor
|
||||
*/
|
||||
public function __construct(string $sColor)
|
||||
{
|
||||
parent::__construct(null, ["ibo-pill ibo-pill-is-{$sColor}"]);
|
||||
parent::__construct();
|
||||
$this->SetColor($sColor);
|
||||
$this->SetUrl('');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,4 +60,32 @@ class Pill extends UIContentBlock
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetUrl(): string
|
||||
{
|
||||
return $this->sUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sUrl
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetUrl(string $sUrl)
|
||||
{
|
||||
$this->sUrl = $sUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function HasUrl(): bool
|
||||
{
|
||||
return !empty($this->sUrl);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,12 @@ use Combodo\iTop\Application\UI\Helper\UIHelper;
|
||||
*/
|
||||
class PillFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sStateCode
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Pill\Pill
|
||||
*/
|
||||
public static function MakeForState(string $sClass, string $sStateCode)
|
||||
{
|
||||
$sColor = UIHelper::GetColorFromStatus($sClass, $sStateCode);
|
||||
|
||||
Reference in New Issue
Block a user