Merge "Horizon selects are now themable: DynamicTypedChoiceField"

This commit is contained in:
Jenkins
2016-08-04 21:41:12 +00:00
committed by Gerrit Code Review
3 changed files with 12 additions and 4 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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):