From 01720bd43c46ce2fa8cd80f31fb3bad3cbea22b6 Mon Sep 17 00:00:00 2001 From: Diana Whitten Date: Wed, 3 Aug 2016 09:43:05 -0700 Subject: [PATCH] Horizon selects are now themable: DynamicTypedChoiceField The DynamicTypedChoiceField is now a themable select. Floating ips have been updated to use it. Change-Id: I41e25f86cb0eaa6d0aadd18a5dc953b047c1581d Partially-implements: blueprint horizon-theme-css-reorg --- horizon/forms/__init__.py | 1 + horizon/forms/fields.py | 6 ++++++ .../access_and_security/floating_ips/workflows.py | 9 +++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/horizon/forms/__init__.py b/horizon/forms/__init__.py index 4f72b2292f..997199ea33 100644 --- a/horizon/forms/__init__.py +++ b/horizon/forms/__init__.py @@ -37,6 +37,7 @@ from horizon.forms.fields import ThemableCheckboxInput # noqa from horizon.forms.fields import ThemableCheckboxSelectMultiple # noqa from horizon.forms.fields import ThemableChoiceField # noqa from horizon.forms.fields import ThemableDynamicChoiceField # noqa +from horizon.forms.fields import ThemableDynamicTypedChoiceField # noqa from horizon.forms.fields import ThemableSelectWidget # noqa from horizon.forms.views import ModalFormMixin # noqa from horizon.forms.views import ModalFormView # noqa diff --git a/horizon/forms/fields.py b/horizon/forms/fields.py index cfcc73ba88..c928b5387f 100644 --- a/horizon/forms/fields.py +++ b/horizon/forms/fields.py @@ -335,6 +335,12 @@ class DynamicTypedChoiceField(DynamicChoiceField, fields.TypedChoiceField): pass +class ThemableDynamicTypedChoiceField(ThemableDynamicChoiceField, + fields.TypedChoiceField): + """Simple mix of ``ThemableDynamicChoiceField`` & ``TypedChoiceField``.""" + pass + + class ThemableCheckboxInput(widgets.CheckboxInput): """A subclass of the ``Checkbox`` widget which renders extra markup to allow a custom checkbox experience. diff --git a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/workflows.py b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/workflows.py index cbc549ce85..7ee001f6a0 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/workflows.py +++ b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/workflows.py @@ -30,10 +30,11 @@ ALLOCATE_URL = "horizon:project:access_and_security:floating_ips:allocate" class AssociateIPAction(workflows.Action): - ip_id = forms.DynamicTypedChoiceField(label=_("IP Address"), - coerce=filters.get_int_or_uuid, - empty_value=None, - add_item_link=ALLOCATE_URL) + ip_id = forms.ThemableDynamicTypedChoiceField( + label=_("IP Address"), + coerce=filters.get_int_or_uuid, + empty_value=None, + add_item_link=ALLOCATE_URL) instance_id = forms.ThemableChoiceField(label=_("Instance")) class Meta(object):