N°2847 First iteration for newsroom menu:

* Kept old js widget but refactored/tweak'd it with some of our new conventions
* Added a newsroom menu component extending popupmenu
* Working as in 2.7
Still todo :
* Add variables for scss file
* Use wiget variables for most of js widget
* Correctly place the popup (absolute with <> containers ? poppers.js ? )
* Intialize toggler red bubble when new messages are in
* Replace hardcoded text in usermenu with correct dict entry updated with the nb of new message
* Only allow to open the popup when ajax calls are done
This commit is contained in:
Stephen Abello
2020-08-06 14:35:02 +02:00
parent c9dab08324
commit a5216de232
19 changed files with 427 additions and 82 deletions

View File

@@ -24,6 +24,7 @@ use ApplicationContext;
use ApplicationMenu;
use appUserPreferences;
use Combodo\iTop\Application\Branding;
use Combodo\iTop\Application\UI\Component\PopoverMenu\NewsroomMenu\NewsroomMenu;
use Combodo\iTop\Application\UI\Component\PopoverMenu\PopoverMenu;
use Combodo\iTop\Application\UI\UIBlock;
use Dict;
@@ -63,6 +64,8 @@ class NavigationMenu extends UIBlock
protected $aUserData;
/** @var \Combodo\iTop\Application\UI\Component\PopoverMenu\PopoverMenu $oUserMenu */
private $oUserMenu;
/** @var \Combodo\iTop\Application\UI\Component\PopoverMenu\NewsroomMenu\NewsroomMenu $oNewsroomMenu */
private $oNewsroomMenu;
/** @var bool $bIsExpanded */
protected $bIsExpanded;
@@ -72,14 +75,14 @@ class NavigationMenu extends UIBlock
* @param string|null $sId
* @param \ApplicationContext $oAppContext
* @param \Combodo\iTop\Application\UI\Component\PopoverMenu\PopoverMenu $oUserMenu
* @param \Combodo\iTop\Application\UI\Component\PopoverMenu\NewsroomMenu\NewsroomMenu|null $oNewsroomMenu
*
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DictExceptionMissingString
* @throws \MySQLException
* @throws \Exception
*/
public function __construct($sId, ApplicationContext $oAppContext, PopoverMenu $oUserMenu)
public function __construct($sId, ApplicationContext $oAppContext, PopoverMenu $oUserMenu, NewsroomMenu $oNewsroomMenu = null)
{
parent::__construct($sId);
@@ -89,6 +92,7 @@ class NavigationMenu extends UIBlock
$this->sAppIconLink = MetaModel::GetConfig()->Get('app_icon_url');
$this->aMenuGroups = ApplicationMenu::GetMenuGroups($oAppContext->GetAsHash());
$this->oUserMenu = $oUserMenu;
$this->oNewsroomMenu = $oNewsroomMenu;
$this->ComputeExpandedState();
$this->ComputeUserData();
@@ -149,6 +153,13 @@ class NavigationMenu extends UIBlock
{
return $this->oUserMenu;
}
/**
* @return \Combodo\iTop\Application\UI\Component\PopoverMenu\NewsroomMenu\NewsroomMenu
*/
public function GetNewsroomMenu()
{
return $this->oNewsroomMenu;
}
/**
* Return true if the menu is expanded