N°4482 - Small refacto

- SCSS partial rule should target only the concerned elements
- Improve PHPDoc
This commit is contained in:
Molkobain
2022-02-02 16:47:15 +01:00
parent 6a4ce3c3b1
commit 7bb7445c91
7 changed files with 43 additions and 33 deletions

View File

@@ -13,14 +13,16 @@ input + label, label + input, label > input {
margin-left: $ibo-input--spacing-left--with-label;
}
label.ibo-has-description {
&::after {
content: $ibo-field--label--description--content;
padding-left: $ibo-field--label--description--padding-left;
vertical-align: top;
.ibo-input-with-label--label {
&.ibo-has-description {
&::after {
content: $ibo-field--label--description--content;
padding-left: $ibo-field--label--description--padding-left;
vertical-align: top;
cursor: pointer;
color: $ibo-field--label--description--color;
@extend %ibo-font-ral-bol-50;
cursor: pointer;
color: $ibo-field--label--description--color;
@extend %ibo-font-ral-bol-50;
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -26,7 +26,7 @@ class InputWithLabel extends UIBlock
/** @var bool Label before input ? */
protected $bBeforeInput;
/**
* @var string $sDescription for tooltip
* @var string|null $sDescription for tooltip
* @since 3.0.1
*/
protected $sDescription;
@@ -109,26 +109,28 @@ class InputWithLabel extends UIBlock
}
/**
* @return string|null
* @since 3.0.1
* @return mixed
*/
public function GetDescription()
public function GetDescription(): ?string
{
return $this->sDescription;
}
/**
* @param string|null $sDescription
* @return $this
* @since 3.0.1
* @param mixed $sDescription
*/
public function SetDescription($sDescription)
public function SetDescription(?string $sDescription)
{
$this->sDescription = $sDescription;
return $this;
}
/**
* @since 3.0.1
* @return bool
* @since 3.0.1
*/
public function HasDescription(): bool
{

View File

@@ -19,10 +19,10 @@ trait tInputLabel
/** @var string|null Label to display with the input (null for no label) */
protected $sLabel = null;
/**
* @var string $sDescription for tooltip
* @var string|null $sDescription for tooltip
* @since 3.0.1
*/
protected $sDescription;
protected $sDescription = null;
/**
* @return bool
@@ -88,29 +88,35 @@ trait tInputLabel
*/
public function HasLabel(): bool
{
return $this->sLabel != null;
return strlen($this->sLabel) > 0;
}
/**
* @return mixed
* @return string|null
* @since 3.0.1
*/
public function GetDescription()
public function GetDescription(): ?string
{
return $this->sDescription;
}
/**
* @param mixed $sDescription
* @param string|null $sDescription
* @return $this
* @since 3.0.1
*/
public function SetDescription($sDescription)
public function SetDescription(?string $sDescription)
{
$this->sDescription = $sDescription;
return $this;
}
/**
* @return bool
* @since 3.0.1
*/
public function HasDescription(): bool
{
return $this->sDescription != null;
return strlen($this->sDescription) > 0;
}
}

View File

@@ -1,10 +1,10 @@
{% block iboInputLabel %}
{% if oUIBlock.IsLabelBefore() %}
<label for="{{ oUIBlock.GetId() }}" {% if oUIBlock.HasDescription() %} class="ibo-has-description" data-tooltip-content="{{ oUIBlock.GetDescription() |raw }}" data-tooltip-max-width="600px" data-tooltip-html-enabled="true"{% endif %}>{{ oUIBlock.GetLabel() |raw }}</label>
<label for="{{ oUIBlock.GetId() }}" {% if oUIBlock.HasDescription() %} class="ibo-input-with-label--label ibo-has-description" data-tooltip-content="{{ oUIBlock.GetDescription() |raw }}" data-tooltip-max-width="600px" data-tooltip-html-enabled="true"{% endif %}>{{ oUIBlock.GetLabel() |raw }}</label>
{{ render_block(oUIBlock.GetInput()) }}
{% else %}
{{ render_block(oUIBlock.GetInput()) }}
<label for="{{ oUIBlock.GetId() }}" {% if oUIBlock.HasDescription() %} class="ibo-has-description" data-tooltip-content="{{ oUIBlock.GetDescription() |raw }}" data-tooltip-max-width="600px" data-tooltip-html-enabled="true"{% endif %}>{{ oUIBlock.GetLabel() |raw }}</label>
<label for="{{ oUIBlock.GetId() }}" {% if oUIBlock.HasDescription() %} class="ibo-input-with-label--label ibo-has-description" data-tooltip-content="{{ oUIBlock.GetDescription() |raw }}" data-tooltip-max-width="600px" data-tooltip-html-enabled="true"{% endif %}>{{ oUIBlock.GetLabel() |raw }}</label>
{% endif %}
{% endblock %}