mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°5905 - Move tab description to a tooltip on the panel's title instead of a big blue alert
This commit is contained in:
@@ -272,6 +272,8 @@ class DisplayBlock
|
||||
'panel_title',
|
||||
/** string true if panel title should be displayed as html */
|
||||
'panel_title_is_html',
|
||||
/** string Description of the panel content, displayed as a hint on the title */
|
||||
'panel_title_tooltip',
|
||||
/** string class for panel block style */
|
||||
'panel_class',
|
||||
/** string class for panel block style */
|
||||
|
||||
@@ -651,6 +651,16 @@ abstract class AttributeDefinition
|
||||
return $sLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool True if the attribute has a description {@see \AttributeDefinition::GetDescription()}
|
||||
* @throws \Exception
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public function HasDescription(): bool
|
||||
{
|
||||
return utils::IsNotNullOrEmptyString($this->GetDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $sDefault
|
||||
*
|
||||
|
||||
@@ -157,6 +157,13 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
|
||||
$oContainer->SetTitle($aExtraParams['panel_title']);
|
||||
}
|
||||
}
|
||||
// - Description
|
||||
if (isset($aExtraParams['panel_title_tooltip'])) {
|
||||
$oContainerTitleBlock = $oContainer->GetTitleBlock()
|
||||
->AddDataAttribute('tooltip-content', $aExtraParams['panel_title_tooltip'])
|
||||
->AddDataAttribute('tooltip-max-width', 'min(600px, 90vw)') // Allow big description to be wide enough while shrinking on small screens
|
||||
->AddCSSClass('ibo-has-description');
|
||||
}
|
||||
|
||||
// Panel subtitle
|
||||
if(!empty($oDataTable->GetInitDisplayData()) && isset($oDataTable->GetInitDisplayData()['recordsTotal'])){
|
||||
|
||||
@@ -113,7 +113,7 @@ abstract class AbstractBlockLinksViewTable extends UIContentBlock
|
||||
}
|
||||
|
||||
/**
|
||||
* InitHeader.
|
||||
* InitHeader by adding UIBlocks to the current self
|
||||
*
|
||||
* @return void
|
||||
* @throws CoreException
|
||||
@@ -121,12 +121,7 @@ abstract class AbstractBlockLinksViewTable extends UIContentBlock
|
||||
*/
|
||||
private function InitHeader()
|
||||
{
|
||||
// Linkset description as an informative alert
|
||||
$sDescription = $this->oAttDef->GetDescription();
|
||||
if (utils::IsNotNullOrEmptyString($sDescription)) {
|
||||
$oAlert = AlertUIBlockFactory::MakeForInformation('', $sDescription);
|
||||
$this->AddSubBlock($oAlert);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,6 +42,11 @@ class BlockDirectLinksViewTable extends AbstractBlockLinksViewTable
|
||||
'panel_icon' => MetaModel::GetClassIcon($this->GetTargetClass(), false),
|
||||
);
|
||||
|
||||
// Description
|
||||
if ($this->oAttDef->HasDescription()) {
|
||||
$aExtraParams['panel_title_tooltip'] = $this->oAttDef->GetDescription();
|
||||
}
|
||||
|
||||
// Add creation in modal if the linkset is not readonly
|
||||
if (!$this->oAttDef->GetReadOnly()) {
|
||||
$aExtraParams['creation_in_modal_is_allowed'] = true;
|
||||
|
||||
@@ -53,6 +53,11 @@ class BlockIndirectLinksViewTable extends AbstractBlockLinksViewTable
|
||||
'panel_title' => $this->oAttDef->GetLabel(),
|
||||
'panel_icon' => MetaModel::GetClassIcon($this->GetTargetClass(), false),
|
||||
);
|
||||
|
||||
// Description
|
||||
if ($this->oAttDef->HasDescription()) {
|
||||
$aExtraParams['panel_title_tooltip'] = $this->oAttDef->GetDescription();
|
||||
}
|
||||
|
||||
// Add creation in modal if the linkset is not readonly
|
||||
if (!$this->oAttDef->GetReadOnly()) {
|
||||
|
||||
Reference in New Issue
Block a user