mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
Make radio form components reusable for nested checkboxes
For the template folders permission editing we need a nested checkboxes form that is similar to "move folder" input, except it's using checkboxes instead of radio buttons. This moves most of the macros into a shared "select-input" components file, which are wrapped by the existing radios.html by setting the required input type.
This commit is contained in:
@@ -837,10 +837,7 @@ class RadioFieldWithNoneOption(FieldWithNoneOption, RadioField):
|
||||
pass
|
||||
|
||||
|
||||
class NestedRadioField(RadioFieldWithNoneOption):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
class NestedFieldMixin:
|
||||
def children(self):
|
||||
# start map with root option as a single child entry
|
||||
child_map = {None: [option for option in self
|
||||
@@ -864,6 +861,14 @@ class NestedRadioField(RadioFieldWithNoneOption):
|
||||
return child_map
|
||||
|
||||
|
||||
class NestedRadioField(RadioFieldWithNoneOption, NestedFieldMixin):
|
||||
pass
|
||||
|
||||
|
||||
class NestedCheckboxesField(SelectMultipleField, NestedFieldMixin):
|
||||
pass
|
||||
|
||||
|
||||
class HiddenFieldWithNoneOption(FieldWithNoneOption, HiddenField):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user