mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
N°4021 - Introduce sticky header for panels and object details (tab container to be done)
This commit is contained in:
@@ -44,6 +44,9 @@ class Panel extends UIContentBlock
|
||||
public const BLOCK_CODE = 'ibo-panel';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/panel/layout';
|
||||
public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/components/panel/layout';
|
||||
public const DEFAULT_JS_FILES_REL_PATH = [
|
||||
'js/components/panel.js',
|
||||
];
|
||||
|
||||
// Specific constants
|
||||
/** @var string ENUM_COLOR_PRIMARY */
|
||||
@@ -103,6 +106,11 @@ class Panel extends UIContentBlock
|
||||
public const DEFAULT_ICON_COVER_METHOD = self::ENUM_ICON_COVER_METHOD_CONTAIN;
|
||||
/** @var bool */
|
||||
public const DEFAULT_ICON_AS_MEDALLION = false;
|
||||
/**
|
||||
* @var bool
|
||||
* @see static::$bIsHeaderVisibleOnScroll
|
||||
*/
|
||||
public const DEFAULT_IS_HEADER_VISIBLE_ON_SCROLL = false;
|
||||
|
||||
/** @var iUIContentBlock $oTitleBlock */
|
||||
protected $oTitleBlock;
|
||||
@@ -118,6 +126,8 @@ class Panel extends UIContentBlock
|
||||
protected $sColor;
|
||||
/** @var bool $bIsCollapsible */
|
||||
protected $bIsCollapsible;
|
||||
/** @var bool $bIsHeaderVisibleOnScroll True if the header of the panel should remain visible when scrolling */
|
||||
protected $bIsHeaderVisibleOnScroll;
|
||||
|
||||
/**
|
||||
* Panel constructor.
|
||||
@@ -146,6 +156,7 @@ class Panel extends UIContentBlock
|
||||
$this->SetMainBlocks([]);
|
||||
$this->SetToolBlocks([]);
|
||||
$this->bIsCollapsible = false;
|
||||
$this->bIsHeaderVisibleOnScroll = static::DEFAULT_IS_HEADER_VISIBLE_ON_SCROLL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -448,6 +459,27 @@ class Panel extends UIContentBlock
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see static::$bIsHeaderVisibleOnScroll
|
||||
* @return bool
|
||||
*/
|
||||
public function IsHeaderVisibleOnScroll(): bool
|
||||
{
|
||||
return $this->bIsHeaderVisibleOnScroll;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see static::$bIsHeaderVisibleOnScroll
|
||||
*
|
||||
* @param bool $bIsHeaderVisibleOnScroll
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetIsHeaderVisibleOnScroll(bool $bIsHeaderVisibleOnScroll)
|
||||
{
|
||||
$this->bIsHeaderVisibleOnScroll = $bIsHeaderVisibleOnScroll;
|
||||
return $this;
|
||||
}
|
||||
|
||||
//----------------------
|
||||
// Specific content area
|
||||
|
||||
@@ -20,6 +20,10 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
|
||||
public const BLOCK_CODE = 'ibo-object-details';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/object/object-details/layout';
|
||||
public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/layouts/object/object-details/layout';
|
||||
public const DEFAULT_JS_FILES_REL_PATH = [
|
||||
'js/components/panel.js',
|
||||
'js/layouts/object/object-details.js',
|
||||
];
|
||||
|
||||
/** @var string Class name of the object (eg. "UserRequest") */
|
||||
protected $sClassName;
|
||||
|
||||
@@ -31,6 +31,9 @@ class ObjectFactory
|
||||
*/
|
||||
public static function MakeDetails(DBObject $oObject, ?string $sMode = cmdbAbstractObject::DEFAULT_OBJECT_MODE)
|
||||
{
|
||||
return new ObjectDetails($oObject, $sMode);
|
||||
$oObjectDetails = new ObjectDetails($oObject, $sMode);
|
||||
$oObjectDetails->SetIsHeaderVisibleOnScroll(true);
|
||||
|
||||
return $oObjectDetails;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user