Add medallion icon block

This commit is contained in:
Stephen Abello
2021-02-23 10:47:58 +01:00
parent c3cb4fbe75
commit defa1e40e1
6 changed files with 142 additions and 1 deletions

View File

@@ -31,4 +31,5 @@
@import "formtablerow";
@import "search-form";
@import "field-badge";
@import "file-select";
@import "file-select";
@import "medallion-icon";

View File

@@ -0,0 +1,21 @@
/*!
* copyright Copyright (C) 2010-2021 Combodo SARL
* license http://opensource.org/licenses/AGPL-3.0
*/
.ibo-medallion-icon{
display: flex;
padding: 13px 0px
}
.ibo-medallion--image{
border-radius: $ibo-border-radius-full;
background-color: $ibo-color-blue-200;
height: 48px;
width: 48px;
padding: 2px;
}
.ibo-medallion-icon--description{
display: inline-block;
padding-left: 8px;
}

View File

@@ -199,6 +199,7 @@ return array(
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\Select\\SelectOption' => $baseDir . '/sources/application/UI/Base/Component/Input/Select/SelectOption.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\Select\\SelectOptionUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Input/Select/SelectOptionUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\TextArea' => $baseDir . '/sources/application/UI/Base/Component/Input/TextArea.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\MedallionIcon\\MedallionIcon' => $baseDir . '/sources/application/UI/Base/Component/MedallionIcon/MedallionIcon.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Panel\\Panel' => $baseDir . '/sources/application/UI/Base/Component/Panel/Panel.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Panel\\PanelEnhanced' => $baseDir . '/sources/application/UI/Base/Component/Panel/PanelEnhanced.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Panel\\PanelUIBlockFactory' => $baseDir . '/sources/application/UI/Base/Component/Panel/PanelUIBlockFactory.php',

View File

@@ -429,6 +429,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\Select\\SelectOption' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Input/Select/SelectOption.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\Select\\SelectOptionUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Input/Select/SelectOptionUIBlockFactory.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Input\\TextArea' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Input/TextArea.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\MedallionIcon\\MedallionIcon' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/MedallionIcon/MedallionIcon.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Panel\\Panel' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Panel/Panel.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Panel\\PanelEnhanced' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Panel/PanelEnhanced.php',
'Combodo\\iTop\\Application\\UI\\Base\\Component\\Panel\\PanelUIBlockFactory' => __DIR__ . '/../..' . '/sources/application/UI/Base/Component/Panel/PanelUIBlockFactory.php',

View File

@@ -0,0 +1,102 @@
<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\MedallionIcon;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
* Class MedallionIcon
*
* @package Combodo\iTop\Application\UI\Base\Component\MedallionIcon
*/
class MedallionIcon extends UIBlock
{
// Overloaded constants
public const BLOCK_CODE = 'ibo-medallion-icon';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/medallion-icon/layout';
public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/components/medallion-icon/layout';
/** @var string $sImageUrl */
private $sImageUrl;
/** @var string $sIconClass */
private $sIconClass;
/** @var string $sDescription */
private $sDescription;
/**
* MedallionIcon constructor.
*
* @param string $sImageUrl
* @param string $sIconClass
* @param null $sId
*/
public function __construct($sImageUrl = '', $sIconClass = '', $sId = null)
{
parent::__construct($sId);
$this->sImageUrl = $sImageUrl;
$this->sIconClass= $sIconClass;
}
/**
* @return string
*/
public function GetImageUrl()
{
return $this->sImageUrl;
}
/**
* @param string $sImageUrl
*
* @return \Combodo\iTop\Application\UI\Base\Component\MedallionIcon\MedallionIcon
*/
public function SetImageUrl($sImageUrl)
{
$this->sImageUrl = $sImageUrl;
return $this;
}
/**
* @return string
*/
public function GetIconClass()
{
return $this->sIconClass;
}
/**
* @param string $sIconClass
*
* @return \Combodo\iTop\Application\UI\Base\Component\MedallionIcon\MedallionIcon
*/
public function SetIconClass($sIconClass)
{
$this->sIconClass = $sIconClass;
return $this;
}
/**
* @return string
*/
public function GetDescription(): string
{
return $this->sDescription;
}
/**
* @param string $sDescription
*
* @return \Combodo\iTop\Application\UI\Base\Component\MedallionIcon\MedallionIcon
*/
public function SetDescription(string $sDescription)
{
$this->sDescription = $sDescription;
return $this;
}
}

View File

@@ -0,0 +1,15 @@
{# @copyright Copyright (C) 2010-2021 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% apply spaceless %}
<div id="{{ oUIBlock.GetId() }}" class="ibo-medallion-icon {{ oUIBlock.GetAdditionalCSSClassesAsString() }}">
{% if oUIBlock.GetImageUrl() != '' %}
<img class="ibo-medallion--image" src="{{ oUIBlock.GetImageUrl() }}" />
{% endif %}
{% if oUIBlock.GetIconClass() != '' %}
<i class="ibo-medallion--image {{ oUIBlock.GetIconClass() }}"></i>
{% endif %}
{% if oUIBlock.GetDescription() != '' %}
<div class="ibo-medallion-icon--description">{{ oUIBlock.GetDescription() }}</div>
{% endif %}
</div>
{% endapply %}