N°1957 - Navigation menu: Show (dismissable) hint for the menu filter

This commit is contained in:
Molkobain
2021-01-17 23:07:39 +01:00
parent ad6646afaf
commit 04b4749510
5 changed files with 67 additions and 10 deletions

View File

@@ -55,6 +55,10 @@ class NavigationMenu extends UIBlock
'js/forms-json-utils.js',
];
// Specific constants
/** @var bool DEFAULT_SHOW_MENU_FILTER_HINT */
public const DEFAULT_SHOW_MENU_FILTER_HINT = true;
/** @var string $sAppRevisionNumber */
protected $sAppRevisionNumber;
/** @var string $sAppSquareIconUrl */
@@ -75,6 +79,8 @@ class NavigationMenu extends UIBlock
private $oNewsroomMenu;
/** @var bool $bIsExpanded */
protected $bIsExpanded;
/** @var bool Whether the hint on how the menu filter works shoudl be displayed or not */
protected $bShowMenuFilterHint;
/**
* NavigationMenu constructor.
@@ -105,6 +111,7 @@ class NavigationMenu extends UIBlock
$this->oNewsroomMenu = $oNewsroomMenu;
$this->ComputeExpandedState();
$this->ComputeMenuFilterHintState();
$this->ComputeUserData();
$this->ComputeSiloSelection();
}
@@ -172,6 +179,7 @@ class NavigationMenu extends UIBlock
{
return $this->oUserMenu;
}
/**
* @return \Combodo\iTop\Application\UI\Base\Component\PopoverMenu\NewsroomMenu\NewsroomMenu
*/
@@ -190,6 +198,15 @@ class NavigationMenu extends UIBlock
return $this->bIsExpanded;
}
/**
* @uses $bShowMenuFilterHint
* @return bool
*/
public function HasMenuFilterHint(): bool
{
return $this->bShowMenuFilterHint;
}
/**
* @inheritDoc
*/
@@ -306,6 +323,20 @@ JS;
return $this;
}
/**
* Compute if the menu filter hint should be displayed or not
*
* @see $bShowMenuFilterHint
*
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MySQLException
*/
protected function ComputeMenuFilterHintState(): void
{
$this->bShowMenuFilterHint = (true === appUserPreferences::GetPref('navigation_menu_filter_hint', static::DEFAULT_SHOW_MENU_FILTER_HINT));
}
/**
* Compute the user data displayed in the menu (organization, name, picture, ...)
*