Use ThemableSelectWidget for themable
Some places are not using ThemableSelectWidget, so these select ui is not themable. This patch fix it. Change-Id: I303a9cf8c6f8f651edf68973a2f5e16a8b04b26d Closes-bug: #1669696
This commit is contained in:
parent
4187837434
commit
00173dc3c8
@ -58,7 +58,7 @@ A simplified example is as follows::
|
||||
('cidr', _('CIDR')),
|
||||
('sg', _('Security Group'))
|
||||
],
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'source'
|
||||
})
|
||||
@ -77,7 +77,7 @@ A simplified example is as follows::
|
||||
security_group = forms.ChoiceField(
|
||||
label=_('Security Group'),
|
||||
required=False,
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'source',
|
||||
'data-source-sg': _('Security Group')
|
||||
|
@ -62,7 +62,7 @@ class AddCGroupInfoAction(workflows.Action):
|
||||
availability_zone = forms.ChoiceField(
|
||||
label=_("Availability Zone"),
|
||||
required=False,
|
||||
widget=forms.Select(
|
||||
widget=forms.ThemableSelectWidget(
|
||||
attrs={'class': 'switched',
|
||||
'data-switch-on': 'source',
|
||||
'data-source-no_source_type': _('Availability Zone'),
|
||||
|
@ -123,7 +123,7 @@ class CreateImageForm(CreateParent):
|
||||
required=False,
|
||||
choices=[('url', _('Image Location')),
|
||||
('file', _('Image File'))],
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'source'}))
|
||||
image_url_attrs = {
|
||||
|
@ -171,6 +171,7 @@ class DecryptPasswordInstanceForm(forms.SelfHandlingForm):
|
||||
|
||||
class AttachVolume(forms.SelfHandlingForm):
|
||||
volume = forms.ChoiceField(label=_("Volume ID"),
|
||||
widget=forms.ThemableSelectWidget(),
|
||||
help_text=_("Select a volume to attach "
|
||||
"to this instance."))
|
||||
device = forms.CharField(label=_("Device Name"),
|
||||
@ -230,6 +231,7 @@ class AttachVolume(forms.SelfHandlingForm):
|
||||
|
||||
class DetachVolume(forms.SelfHandlingForm):
|
||||
volume = forms.ChoiceField(label=_("Volume ID"),
|
||||
widget=forms.ThemableSelectWidget(),
|
||||
help_text=_("Select a volume to detach "
|
||||
"from this instance."))
|
||||
instance_id = forms.CharField(widget=forms.HiddenInput())
|
||||
|
@ -4742,7 +4742,7 @@ class ConsoleManagerTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
|
||||
self.assertEqual(res.status_code, 200)
|
||||
self.assertFalse(form.fields['device'].required)
|
||||
self.assertIsInstance(form.fields['volume'].widget,
|
||||
forms.Select)
|
||||
forms.ThemableSelectWidget)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/instances/attach_volume.html')
|
||||
|
||||
@ -4783,7 +4783,7 @@ class ConsoleManagerTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
|
||||
form = res.context['form']
|
||||
|
||||
self.assertIsInstance(form.fields['volume'].widget,
|
||||
forms.Select)
|
||||
forms.ThemableSelectWidget)
|
||||
self.assertEqual(res.status_code, 200)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/instances/detach_volume.html')
|
||||
|
@ -59,14 +59,14 @@ class CreatePort(forms.SelfHandlingForm):
|
||||
choices=[('', _("Unspecified")),
|
||||
('subnet_id', _("Subnet")),
|
||||
('fixed_ip', _("Fixed IP Address"))],
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'specify_ip',
|
||||
}))
|
||||
subnet_id = forms.ThemableChoiceField(
|
||||
label=_("Subnet"),
|
||||
required=False,
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'specify_ip',
|
||||
'data-specify_ip-subnet_id': _('Subnet'),
|
||||
|
@ -121,14 +121,14 @@ class CreateSubnetInfoAction(workflows.Action):
|
||||
label=_('Network Address Source'),
|
||||
choices=[('manual', _('Enter Network Address manually')),
|
||||
('subnetpool', _('Allocate Network Address from a pool'))],
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'source',
|
||||
}))
|
||||
|
||||
subnetpool = forms.ChoiceField(
|
||||
label=_("Address pool"),
|
||||
widget=forms.SelectWidget(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switched switchable',
|
||||
'data-slug': 'subnetpool',
|
||||
'data-switch-on': 'source',
|
||||
@ -142,7 +142,7 @@ class CreateSubnetInfoAction(workflows.Action):
|
||||
if 'prefixes' in x else "%s" % (x.name)),
|
||||
required=False)
|
||||
|
||||
prefixlen = forms.ChoiceField(widget=forms.Select(attrs={
|
||||
prefixlen = forms.ChoiceField(widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'subnetpool',
|
||||
}),
|
||||
@ -162,7 +162,7 @@ class CreateSubnetInfoAction(workflows.Action):
|
||||
version=forms.IPv4 | forms.IPv6,
|
||||
mask=True)
|
||||
ip_version = forms.ChoiceField(choices=[(4, 'IPv4'), (6, 'IPv6')],
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'ipversion',
|
||||
}),
|
||||
@ -348,7 +348,7 @@ class CreateSubnetDetailAction(workflows.Action):
|
||||
initial=True, required=False)
|
||||
ipv6_modes = forms.ChoiceField(
|
||||
label=_("IPv6 Address Configuration Mode"),
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'ipversion',
|
||||
'data-ipversion-6': _("IPv6 Address Configuration Mode"),
|
||||
|
@ -104,7 +104,7 @@ class UpdateGroup(GroupBase):
|
||||
class AddRule(forms.SelfHandlingForm):
|
||||
id = forms.CharField(widget=forms.HiddenInput())
|
||||
rule_menu = forms.ChoiceField(label=_('Rule'),
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'rule_menu'}))
|
||||
|
||||
@ -114,7 +114,7 @@ class AddRule(forms.SelfHandlingForm):
|
||||
direction = forms.ChoiceField(
|
||||
label=_('Direction'),
|
||||
required=False,
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'rule_menu',
|
||||
'data-rule_menu-tcp': _('Direction'),
|
||||
@ -139,7 +139,7 @@ class AddRule(forms.SelfHandlingForm):
|
||||
label=_('Open Port'),
|
||||
choices=[('port', _('Port')),
|
||||
('range', _('Port Range'))],
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switchable switched',
|
||||
'data-slug': 'range',
|
||||
'data-switch-on': 'rule_menu',
|
||||
@ -210,7 +210,7 @@ class AddRule(forms.SelfHandlingForm):
|
||||
'members of another security '
|
||||
'group select "Security '
|
||||
'Group".'),
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'remote'}))
|
||||
|
||||
@ -229,18 +229,19 @@ class AddRule(forms.SelfHandlingForm):
|
||||
|
||||
security_group = forms.ChoiceField(label=_('Security Group'),
|
||||
required=False,
|
||||
widget=forms.Select(attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'remote',
|
||||
'data-remote-sg': _('Security '
|
||||
'Group')}))
|
||||
widget=forms.ThemableSelectWidget(
|
||||
attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'remote',
|
||||
'data-remote-sg': _('Security '
|
||||
'Group')}))
|
||||
# When cidr is used ethertype is determined from IP version of cidr.
|
||||
# When source group, ethertype needs to be specified explicitly.
|
||||
ethertype = forms.ChoiceField(label=_('Ether Type'),
|
||||
required=False,
|
||||
choices=[('IPv4', _('IPv4')),
|
||||
('IPv6', _('IPv6'))],
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switched',
|
||||
'data-slug': 'ethertype',
|
||||
'data-switch-on': 'remote',
|
||||
|
@ -67,7 +67,8 @@ class TemplateForm(forms.SelfHandlingForm):
|
||||
attributes = {'class': 'switchable', 'data-slug': 'templatesource'}
|
||||
template_source = forms.ChoiceField(label=_('Template Source'),
|
||||
choices=base_choices + url_choice,
|
||||
widget=forms.Select(attrs=attributes))
|
||||
widget=forms.ThemableSelectWidget(
|
||||
attrs=attributes))
|
||||
|
||||
attributes = create_upload_form_attributes(
|
||||
'template',
|
||||
@ -103,7 +104,7 @@ class TemplateForm(forms.SelfHandlingForm):
|
||||
environment_source = forms.ChoiceField(
|
||||
label=_('Environment Source'),
|
||||
choices=base_choices,
|
||||
widget=forms.Select(attrs=attributes),
|
||||
widget=forms.ThemableSelectWidget(attrs=attributes),
|
||||
required=False)
|
||||
|
||||
attributes = create_upload_form_attributes(
|
||||
|
@ -73,7 +73,7 @@ class UpdateIKEPolicy(forms.SelfHandlingForm):
|
||||
auth_algorithm = forms.ChoiceField(
|
||||
label=_("Authorization algorithm"),
|
||||
choices=[('sha1', _('sha1'))],
|
||||
widget=forms.Select(attrs={'readonly': 'readonly'}),
|
||||
widget=forms.ThemableSelectWidget(attrs={'readonly': 'readonly'}),
|
||||
required=False)
|
||||
encryption_algorithm = forms.ChoiceField(
|
||||
label=_("Encryption algorithm"),
|
||||
@ -91,7 +91,7 @@ class UpdateIKEPolicy(forms.SelfHandlingForm):
|
||||
lifetime_units = forms.ChoiceField(
|
||||
label=_("Lifetime units for IKE keys"),
|
||||
choices=[('seconds', _('seconds'))],
|
||||
widget=forms.Select(attrs={'readonly': 'readonly'}),
|
||||
widget=forms.ThemableSelectWidget(attrs={'readonly': 'readonly'}),
|
||||
required=False)
|
||||
lifetime_value = forms.IntegerField(
|
||||
min_value=60,
|
||||
@ -108,7 +108,7 @@ class UpdateIKEPolicy(forms.SelfHandlingForm):
|
||||
phase1_negotiation_mode = forms.ChoiceField(
|
||||
label=_("IKE Phase1 negotiation mode"),
|
||||
choices=[('main', 'main')],
|
||||
widget=forms.Select(attrs={'readonly': 'readonly'}),
|
||||
widget=forms.ThemableSelectWidget(attrs={'readonly': 'readonly'}),
|
||||
required=False)
|
||||
|
||||
failure_url = 'horizon:project:vpn:index'
|
||||
@ -170,7 +170,7 @@ class UpdateIPSecPolicy(forms.SelfHandlingForm):
|
||||
lifetime_units = forms.ChoiceField(
|
||||
label=_("Lifetime units"),
|
||||
choices=[('seconds', _('seconds'))],
|
||||
widget=forms.Select(attrs={'readonly': 'readonly'}),
|
||||
widget=forms.ThemableSelectWidget(attrs={'readonly': 'readonly'}),
|
||||
required=False)
|
||||
lifetime_value = forms.IntegerField(
|
||||
min_value=60,
|
||||
|
Loading…
Reference in New Issue
Block a user