mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°3573 - Allow disabling buttons
This commit is contained in:
@@ -77,6 +77,8 @@ class Button extends UIBlock
|
||||
protected $sJsCode;
|
||||
/** @var string $sOnClickJsCode */
|
||||
protected $sOnClickJsCode;
|
||||
/** @var bool $bIsDisabled */
|
||||
protected $bIsDisabled;
|
||||
|
||||
/**
|
||||
* Button constructor.
|
||||
@@ -102,6 +104,7 @@ class Button extends UIBlock
|
||||
$this->sJsCode = $sJsCode;
|
||||
$this->sOnClickJsCode = $sOnClickJsCode;
|
||||
$this->aDataAttributes = ['role' => 'ibo-button'];
|
||||
$this->bIsDisabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,4 +243,24 @@ class Button extends UIBlock
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsDisabled()
|
||||
{
|
||||
return $this->bIsDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bIsDisabled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetIsDisabled(bool $bIsDisabled)
|
||||
{
|
||||
$this->bIsDisabled = $bIsDisabled;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -48,8 +48,6 @@ class ButtonJS extends Button
|
||||
protected $sName;
|
||||
/** @var string $sValue The HTML value of the button, used by forms */
|
||||
protected $sValue;
|
||||
/** @var bool $bIsDisabled */
|
||||
protected $bIsDisabled;
|
||||
|
||||
/**
|
||||
* ButtonJS constructor.
|
||||
@@ -78,7 +76,6 @@ class ButtonJS extends Button
|
||||
$this->sName = $sName;
|
||||
$this->sValue = $sValue;
|
||||
$this->sType = $sType;
|
||||
$this->bIsDisabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,25 +134,4 @@ class ButtonJS extends Button
|
||||
$this->sValue = $sValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsDisabled()
|
||||
{
|
||||
return $this->bIsDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bIsDisabled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetIsDisabled(bool $bIsDisabled)
|
||||
{
|
||||
$this->bIsDisabled = $bIsDisabled;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
data-{{ sName }}="{{ sValue }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if oUIBlock.IsDisabled() %} disabled {% endif %}
|
||||
{# Visual tooltip... #}
|
||||
{% if oUIBlock.GetTooltip() is not empty %}
|
||||
data-tooltip-content="{{ oUIBlock.GetTooltip() }}"
|
||||
|
||||
Reference in New Issue
Block a user