Merge "Add asterisk mark for the required field on create volume form"
This commit is contained in:
commit
4865b3240f
@ -630,29 +630,6 @@ horizon.addInitFunction(horizon.forms.init = function () {
|
||||
}
|
||||
});
|
||||
|
||||
// Handle field toggles for the Create Volume source type field
|
||||
function update_volume_source_displayed_fields (field) {
|
||||
var $this = $(field),
|
||||
base_type = $this.val();
|
||||
|
||||
$this.find("option").each(function () {
|
||||
if (this.value !== base_type) {
|
||||
$("#id_" + this.value).closest(".form-group").hide();
|
||||
} else {
|
||||
$("#id_" + this.value).closest(".form-group").show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$document.on('change', '#id_volume_source_type', function () {
|
||||
update_volume_source_displayed_fields(this);
|
||||
});
|
||||
|
||||
$('#id_volume_source_type').change();
|
||||
horizon.modals.addModalInitFunction(function (modal) {
|
||||
$(modal).find("#id_volume_source_type").change();
|
||||
});
|
||||
|
||||
/* Help tooltips */
|
||||
|
||||
// Apply standard handler for everything but checkboxes.
|
||||
|
@ -90,21 +90,33 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
snapshot_source = forms.ChoiceField(
|
||||
label=_("Use snapshot as a source"),
|
||||
widget=forms.ThemableSelectWidget(
|
||||
attrs={'class': 'snapshot-selector'},
|
||||
attrs={'class': 'snapshot-selector switched',
|
||||
'data-switch-on': 'source',
|
||||
'data-source-snapshot_source':
|
||||
_("Use snapshot as a source"),
|
||||
'data-required-when-shown': 'true'},
|
||||
data_attrs=('size', 'name'),
|
||||
transform=lambda x: "%s (%s GiB)" % (x.name, x.size)),
|
||||
required=False)
|
||||
image_source = forms.ChoiceField(
|
||||
label=_("Use image as a source"),
|
||||
widget=forms.ThemableSelectWidget(
|
||||
attrs={'class': 'image-selector'},
|
||||
attrs={'class': 'image-selector switched',
|
||||
'data-switch-on': 'source',
|
||||
'data-source-image_source':
|
||||
_("Use image as a source"),
|
||||
'data-required-when-shown': 'true'},
|
||||
data_attrs=('size', 'name', 'min_disk'),
|
||||
transform=lambda x: "%s (%s)" % (x.name, filesizeformat(x.bytes))),
|
||||
required=False)
|
||||
volume_source = forms.ChoiceField(
|
||||
label=_("Use a volume as source"),
|
||||
widget=forms.ThemableSelectWidget(
|
||||
attrs={'class': 'image-selector'},
|
||||
attrs={'class': 'image-selector switched',
|
||||
'data-switch-on': 'source',
|
||||
'data-source-volume_source':
|
||||
_("Use a volume as source"),
|
||||
'data-required-when-shown': 'true'},
|
||||
data_attrs=('size', 'name'),
|
||||
transform=lambda x: "%s (%s GiB)" % (x.name, x.size)),
|
||||
required=False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user