N°3882 - Object details: Status indicator (dot) now shows the real state color

This commit is contained in:
Molkobain
2021-09-22 16:18:57 +02:00
parent 1e73ee8ccd
commit 197864ff83
3 changed files with 10 additions and 14 deletions

View File

@@ -28,7 +28,7 @@ $ibo-object-details--tag--separator--diameter: 5px !default;
$ibo-object-details--tag--separator--margin-right: 12px !default;
$ibo-object-details--tag--separator--border-radius: $ibo-border-radius-full !default;
/* Parent block overloads (!= than blocks integrations */
/* Parent block overloads (!= than blocks integrations) */
.ibo-object-details {
&.ibo-has-icon.ibo-has-medallion-icon {
// Note: Direct child selector is mandatory, otherwise a panel within a panel with a medallion icon will have its icon as a medallion too (eg. dashboard in an object)
@@ -84,13 +84,6 @@ $ibo-object-details--tag--separator--border-radius: $ibo-border-radius-full !def
}
}
@each $sType, $aColors in $ibo-lifecycle-states-colors {
.ibo-object-details--status-dot.ibo-is-state-#{$sType} {
color: map-get($aColors, 'secondary-color');
background-color: map-get($aColors, 'primary-color');
}
}
.ibo-object-details--tag {
color: $ibo-object-details--tag--color;

View File

@@ -59,9 +59,9 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
protected $sObjectMode;
/** @var string */
protected $sIconUrl;
/** @var string */
/** @var string Code of the current value of the attribute carrying the state for $sClassName */
protected $sStatusCode;
/** @var string */
/** @var string Label of the current value of the attribute carrying the state for $sClassName */
protected $sStatusLabel;
/** @var string */
protected $sStatusColor;
@@ -223,18 +223,21 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
}
/**
* @param \DBObject $oObject
* @see static::$oObject
*
* @param \DBObject $oObject
*
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \CoreException*@throws \Exception
*/
protected function ComputeState(DBObject $oObject): void
{
if (MetaModel::HasStateAttributeCode($this->sClassName)) {
$this->sStatusCode = $oObject->GetState();
$this->sStatusLabel = $oObject->GetStateLabel();
$this->sStatusColor = UIHelper::GetColorFromStatus($this->sClassName, $this->sStatusCode);
$oStyle = MetaModel::GetEnumStyle($this->sClassName, MetaModel::GetStateAttributeCode($this->sClassName), $this->sStatusCode);
$this->sStatusColor = $oStyle->GetMainColor();
}
}

View File

@@ -12,7 +12,7 @@
{% block iboPanelSubTitle %}
{% if oUIBlock.GetStatusLabel() is not empty %}
<span class="ibo-object-details--status" data-role="ibo-object-details--status" data-status-code="{{ oUIBlock.GetStatusCode() }}">
<span class="ibo-object-details--status-dot ibo-is-state-{{ oUIBlock.GetStatusColor() }}" data-role="ibo-object-details--status-dot"></span>
<span class="ibo-object-details--status-dot" data-role="ibo-object-details--status-dot" style="background-color: {{ oUIBlock.GetStatusColor() }};"></span>
<span class="ibo-object-details--status-label" data-role="ibo-object-details--status-label">{{ oUIBlock.GetStatusLabel() }}</span>
</span>
{% endif %}