mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°2039 - Rework view all notifications page (#617)
* N°2039 - Rework view all notifications page * N°2039 - Replace modals with toasts * N°2039 - Add bulk mode to view all notifications page * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Update css/backoffice/pages/_notifications.scss * Update dictionaries/ui/application/newsroom/fr.dictionary.itop.newsroom.php * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Add since in phpdoc * Change newsroom empty notification illustration * N°2039 - Refactor code to factorize logic --------- Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
This commit is contained in:
@@ -38,14 +38,8 @@ class ButtonGroup extends UIBlock
|
||||
/**
|
||||
* Button constructor.
|
||||
*
|
||||
* @param string $sLabel
|
||||
* @param array $aButtons
|
||||
* @param string|null $sId
|
||||
* @param string $sTooltip
|
||||
* @param string $sIconClass
|
||||
* @param string $sActionType
|
||||
* @param string $sColor
|
||||
* @param string $sJsCode
|
||||
* @param string $sOnClickJsCode
|
||||
*/
|
||||
public function __construct(array $aButtons = [], ?string $sId = null)
|
||||
{
|
||||
|
||||
@@ -95,10 +95,11 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @param string $sLabel
|
||||
* @param \Combodo\iTop\Application\UI\Base\Component\Input\Input $oInput
|
||||
* @param string|null $sId
|
||||
* @since 3.2.0 method is now public
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\InputWithLabel
|
||||
*/
|
||||
private static function MakeInputWithLabel(string $sName, string $sLabel, Input $oInput, ?string $sId = null)
|
||||
public static function MakeInputWithLabel(string $sName, string $sLabel, Input $oInput, ?string $sId = null)
|
||||
{
|
||||
$oInput->SetName($sName);
|
||||
|
||||
|
||||
@@ -138,4 +138,8 @@ class InputWithLabel extends UIBlock
|
||||
return utils::IsNotNullOrEmptyString($this->sDescription);
|
||||
}
|
||||
|
||||
public function GetSubBlocks(): array
|
||||
{
|
||||
return [$this->oInput->GetId() => $this->oInput];
|
||||
}
|
||||
}
|
||||
37
sources/Application/UI/Base/Component/Input/Toggler.php
Normal file
37
sources/Application/UI/Base/Component/Input/Toggler.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input;
|
||||
|
||||
|
||||
/**
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Input
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Toggler extends Input {
|
||||
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-toggler';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/input/input-toggler';
|
||||
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'base/components/input/input-toggler';
|
||||
|
||||
|
||||
public function __construct(?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->SetType('checkbox');
|
||||
}
|
||||
|
||||
public function SetIsToggled(bool $bIsToggled): static
|
||||
{
|
||||
return $this->SetIsChecked($bIsToggled);
|
||||
}
|
||||
|
||||
public function IsToggled(): bool
|
||||
{
|
||||
return $this->IsChecked();
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ class NewsroomMenuFactory
|
||||
$sPlaceholderImageUrl= 'far fa-envelope';
|
||||
$aParams = array(
|
||||
'image_icon' => $sImageUrl,
|
||||
'no_message_icon' => file_get_contents(APPROOT.'images/illustrations/undraw_empty.svg'),
|
||||
'no_message_icon' => file_get_contents(APPROOT.'images/illustrations/undraw_social_serenity.svg'),
|
||||
'placeholder_image_icon' => $sPlaceholderImageUrl,
|
||||
'cache_uuid' => 'itop-newsroom-'.UserRights::GetUserId().'-'.md5(APPROOT),
|
||||
'providers' => $aProviderParams,
|
||||
|
||||
@@ -103,6 +103,17 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
|
||||
return $this->sClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see self::$sClassLabel
|
||||
* @return $this
|
||||
*/
|
||||
public function SetClassLabel($sClassLabel)
|
||||
{
|
||||
$this->sClassLabel = $sClassLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see self::$sClassLabel
|
||||
* @return string
|
||||
|
||||
@@ -102,8 +102,8 @@ class ObjectSummary extends ObjectDetails
|
||||
{
|
||||
$oRouter = Router::GetInstance();
|
||||
$oDetailsButton = null;
|
||||
if(UserRights::IsActionAllowed($this->sClassName, UR_ACTION_MODIFY)) {
|
||||
$sRootUrl = utils::GetAbsoluteUrlAppRoot();
|
||||
// We can pass a DBObject to the UIBlock, so we check for the DisplayModifyForm method
|
||||
if(method_exists($this->oObject, 'DisplayModifyForm') && UserRights::IsActionAllowed($this->sClassName, UR_ACTION_MODIFY)) {
|
||||
$oPopoverMenu = new PopoverMenu();
|
||||
|
||||
$oDetailsAction = new URLPopupMenuItem(
|
||||
|
||||
Reference in New Issue
Block a user