Correzione icon-after nei checkbox

This commit is contained in:
Beppe 2022-06-03 12:59:42 +02:00
parent 97393ac0b1
commit bd1dd44c1b
2 changed files with 16 additions and 14 deletions

View File

@ -71,19 +71,17 @@ class ChoicesHandler implements HandlerInterface
// Generazione del codice HTML
// "+ this.checked" rende il valore booleano un numero
$result = '
<div class="form-group checkbox-group">
<input type="hidden" name="|name|" value="|value|" class="openstamanager-input">
<input type="checkbox" id="|id|" value="|value|" class="hidden" |attr| onchange="$(this).parent().find(\'[type = hidden]\').val(+this.checked).trigger(\'change\')"/>
<div class="btn-group checkbox-buttons">
<label for="|id|" class="btn btn-default'.$class.'">
<span class="fa fa-check text-success"></span>
<span class="fa fa-close text-danger"></span>
</label>
<label for="|id|" class="btn btn-default active'.$class.'">
<span class="text-success">'.tr('Attivato').'</span>
<span class="text-danger">'.tr('Disattivato').'</span>
</label>
</div>
<input type="hidden" name="|name|" value="|value|" class="openstamanager-input">
<input type="checkbox" id="|id|" value="|value|" class="hidden" |attr| onchange="$(this).parent().find(\'[type = hidden]\').val(+this.checked).trigger(\'change\')"/>
<div class="btn-group checkbox-buttons">
<label for="|id|" class="btn btn-default'.$class.'">
<span class="fa fa-check text-success"></span>
<span class="fa fa-close text-danger"></span>
</label>
<label for="|id|" class="btn btn-default active'.$class.'">
<span class="text-success">'.tr('Attivato').'</span>
<span class="text-danger">'.tr('Disattivato').'</span>
</label>
</div>';
return $result;

View File

@ -30,6 +30,10 @@ class HTMLWrapper implements WrapperInterface
{
$result = '';
if( $values['type']=='checkbox' ){
$values['class'] = 'checkbox-group';
}
// Valori particolari
$values['icon-before'] = isset($values['icon-before']) ? $this->parser($values, $extras, $values['icon-before']) : null;
$values['icon-after'] = isset($values['icon-after']) ? $this->parser($values, $extras, $values['icon-after']) : null;
@ -37,7 +41,7 @@ class HTMLWrapper implements WrapperInterface
// Generazione dell'etichetta
if (!empty($values['label'])) {
$result .= '
<div class="form-group">
<div class="form-group '.$values['class'].'">
<label for="'.prepareToField($values['id']).'">'.(empty($values['help']) ? $values['label'] : '<span class="tip" title="'.prepareToField($values['help']).'">'.$values['label'].' <i class="fa fa-question-circle-o"></i></span>').'</label>';
}