Code cleanup

This commit is contained in:
Molkobain
2021-03-03 17:26:34 +01:00
parent b4ce1b7ae6
commit 6c20f74b90
3 changed files with 8 additions and 8 deletions

View File

@@ -408,18 +408,18 @@ EOF
}
$sLabel = Dict::S('Tag:Synchronized');
$sSynchroTagId = 'synchro_icon-'.$this->GetKey();
$aIcons[$sSynchroTagId] = ['title' => $sTip, 'cssClasses' => 'ibo-title--object-tags--synchronized', 'iconCssClasses' => 'fas fa-lock', 'label' => $sLabel];
$aIcons[$sSynchroTagId] = ['title' => $sTip, 'css_classes' => 'ibo-title--object-tags--synchronized', 'decoration_classes' => 'fas fa-lock', 'label' => $sLabel];
}
}
if ($this->IsArchived()) {
$sLabel = Dict::S('Tag:Archived');
$sTitle = Dict::S('Tag:Archived+');
$aIcons['archived'] = ['title' => $sTitle, 'cssClasses' => 'ibo-title--object-tags--archived', 'iconCssClasses' => 'fas fa-archive', 'label' => $sLabel];
$aIcons['archived'] = ['title' => $sTitle, 'css_classes' => 'ibo-title--object-tags--archived', 'decoration_classes' => 'fas fa-archive', 'label' => $sLabel];
} elseif ($this->IsObsolete()) {
$sLabel = Dict::S('Tag:Obsolete');
$sTitle = Dict::S('Tag:Obsolete+');
$aIcons['obsolete'] = ['title' => $sTitle, 'cssClasses' => 'ibo-title--object-tags--obsolete', 'iconCssClasses' => 'ibo- fas fa-eye-slash', 'label' => $sLabel];
$aIcons['obsolete'] = ['title' => $sTitle, 'css_classes' => 'ibo-title--object-tags--obsolete', 'decoration_classes' => 'fas fa-eye-slash', 'label' => $sLabel];
}
$oPage->AddUiBlock(TitleUIBlockFactory::MakeForObjectDetails($this, $aIcons));

View File

@@ -34,7 +34,7 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
return $oTitle;
}
public static function MakeForObjectDetails(DBObject $oObject, array $aIcons = [], ?string $sId = null)
public static function MakeForObjectDetails(DBObject $oObject, array $aTags = [], ?string $sId = null)
{
// TODO 3.0.0: Refactor all of this
$sObjClass = get_class($oObject);
@@ -70,14 +70,14 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
$sStateCode = $oObject->GetState();
// Protection against classes with no default state (in which case we don't display the status)
if(!empty($sStateCode)) {
if (!empty($sStateCode)) {
$sStatusAttCode = MetaModel::GetStateAttributeCode($sObjClass);
$sStatusLabel = $oObject->GetStateLabel();
$sStatusColor = UIHelper::GetColorFromStatus(get_class($oObject), $sStateCode);
$oTitle->SetStatus($sStatusAttCode, $sStatusLabel, $sStatusColor);
}
}
$oTitle->SetTags($aIcons);
$oTitle->SetTags($aTags);
return $oTitle;
}

View File

@@ -12,8 +12,8 @@
</span>
{% endif %}
<span class="ibo-title--object-class">{{ oUIBlock.GetClassName() }}</span>
{% for tag, tagValues in oUIBlock.GetTags() %}
<span id="{{ tag }}" class="ibo-title--object-tags {{ tagValues.cssClasses }}" data-tooltip-content="{{ tagValues.title }}" data-tooltip-html-enabled="true"><i class="{{ tagValues.iconCssClasses }}"></i>{{ tagValues.label }}</span>
{% for sTag, aTagValues in oUIBlock.GetTags() %}
<span id="{{ sTag }}" class="ibo-title--object-tags {{ aTagValues.css_classes }}" data-tooltip-content="{{ aTagValues.title }}" data-tooltip-html-enabled="true"><i class="{{ aTagValues.decoration_classes }}"></i>{{ aTagValues.label }}</span>
{% endfor %}
</div>
{% endblock %}