ToggleObjectFeaturesCommandForm: Use a select instead of radio buttons
refs #3957
This commit is contained in:
parent
30a4c62a2a
commit
b3c6af4ea6
|
@ -80,17 +80,25 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
|
|||
$options['description'] = $this->translate('changed');
|
||||
}
|
||||
if ($formData[$feature] === 2) {
|
||||
$options['multiOptions'] = array(
|
||||
$this->translate('disable'),
|
||||
$this->translate('enable'),
|
||||
);
|
||||
$options['separator'] = '';
|
||||
$elementType = 'radio';
|
||||
$this->addElement('select', $feature, $options + [
|
||||
'description' => $this->translate('Multiple Values'),
|
||||
'filters' => [['Null', ['type' => \Zend_Filter_Null::STRING]]],
|
||||
'multiOptions' => [
|
||||
'' => $this->translate('Leave Unchanged'),
|
||||
$this->translate('Disable All'),
|
||||
$this->translate('Enable All')
|
||||
],
|
||||
'decorators' => array_merge(
|
||||
array_slice(static::$defaultElementDecorators, 0, 3),
|
||||
[['Description', ['tag' => 'span']]],
|
||||
array_slice(static::$defaultElementDecorators, 4, 1),
|
||||
[['HtmlTag', ['tag' => 'div', 'class' => 'control-group indeterminate']]]
|
||||
)
|
||||
]);
|
||||
} else {
|
||||
$elementType = 'checkbox';
|
||||
$options['value'] = $formData[$feature];
|
||||
$this->addElement('checkbox', $feature, $options);
|
||||
}
|
||||
$this->addElement($elementType, $feature, $options);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -629,11 +629,39 @@ form.instance-features span.description, form.object-features span.description {
|
|||
.control-group {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
|
||||
&.indeterminate {
|
||||
justify-content: flex-start;
|
||||
|
||||
.control-label-group {
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
|
||||
select {
|
||||
width: auto;
|
||||
flex: 0 1 auto;
|
||||
|
||||
& + span.hint {
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.toggle-switch {
|
||||
margin-left: @table-column-padding;
|
||||
}
|
||||
|
||||
select {
|
||||
margin-right: .5em;
|
||||
margin-left: @table-column-padding;
|
||||
|
||||
& + span.hint {
|
||||
margin: .35em;
|
||||
color: @gray-light;
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.plugin-output {
|
||||
|
|
Loading…
Reference in New Issue