N°5905 - Fix linkset panel description still in an alert when editing host object

This commit is contained in:
Molkobain
2023-02-01 18:09:46 +01:00
parent 0cce58e0cf
commit 72a586e490
2 changed files with 19 additions and 13 deletions

View File

@@ -114,12 +114,7 @@ class BlockDirectLinksEditTable extends UIContentBlock
*/
private function InitUI()
{
// Linkset description as an informative alert
$sDescription = $this->oAttributeLinkedSet->GetDescription();
if (utils::IsNotNullOrEmptyString($sDescription)) {
$oAlert = AlertUIBlockFactory::MakeForInformation('', $sDescription);
$this->AddSubBlock($oAlert);
}
}
/**
@@ -148,6 +143,15 @@ class BlockDirectLinksEditTable extends UIContentBlock
->SetIcon(MetaModel::GetClassIcon($this->oUILinksDirectWidget->GetLinkedClass(), false))
->AddCSSClass('ibo-datatable-panel');
// - Panel description
$sDescription = $this->oAttributeLinkedSet->GetDescription();
if (utils::IsNotNullOrEmptyString($sDescription)) {
$oTitleBlock = $aTablePanel->GetTitleBlock()
->AddDataAttribute('tooltip-content', $sDescription)
->AddDataAttribute('tooltip-max-width', 'min(600px, 90vw)') // Allow big description to be wide enough while shrinking on small screens
->AddCSSClass('ibo-has-description');
}
// Toolbar and actions
$oToolbar = ToolbarUIBlockFactory::MakeForButton();
$oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral('Unlink');

View File

@@ -107,13 +107,6 @@ class BlockIndirectLinksEditTable extends UIContentBlock
// To prevent adding forms inside the main form
$oDeferredBlock = new UIContentBlock("dlg_{$this->oUILinksWidget->GetLinkedSetId()}", ['ibo-block-indirect-links--edit--dialog']);
$this->AddDeferredBlock($oDeferredBlock);
// Linkset description as an informative alert
$sDescription = $this->oAttributeLinkedSetIndirect->GetDescription();
if (utils::IsNotNullOrEmptyString($sDescription)) {
$oAlert = AlertUIBlockFactory::MakeForInformation('', $sDescription);
$this->AddSubBlock($oAlert);
}
}
/**
@@ -204,6 +197,15 @@ class BlockIndirectLinksEditTable extends UIContentBlock
->SetIcon(MetaModel::GetClassIcon($this->oUILinksWidget->GetRemoteClass(), false))
->AddCSSClass('ibo-datatable-panel');
// - Panel description
$sDescription = $this->oAttributeLinkedSetIndirect->GetDescription();
if (utils::IsNotNullOrEmptyString($sDescription)) {
$oTitleBlock = $aTablePanel->GetTitleBlock()
->AddDataAttribute('tooltip-content', $sDescription)
->AddDataAttribute('tooltip-max-width', 'min(600px, 90vw)') // Allow big description to be wide enough while shrinking on small screens
->AddCSSClass('ibo-has-description');
}
// Toolbar and actions
$oToolbar = ToolbarUIBlockFactory::MakeForButton();
$oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral('Unlink');