Port the campaign management page to auto.

Also fixes the oversight in the previous commit where float options were
not saved when changed.
This commit is contained in:
Dan Albert
2021-10-21 19:15:47 -07:00
parent 7bec4c62f7
commit a618f00662
9 changed files with 212 additions and 229 deletions

View File

@@ -6,17 +6,22 @@ from .optiondescription import OptionDescription, SETTING_DESCRIPTION_KEY
@dataclass(frozen=True)
class BooleanOption(OptionDescription):
pass
invert: bool
def boolean_option(
text: str,
page: str,
section: str,
default: bool,
invert: bool = False,
detail: Optional[str] = None,
**kwargs: Any,
) -> bool:
return field(
metadata={SETTING_DESCRIPTION_KEY: BooleanOption(page, section, text, detail)},
metadata={
SETTING_DESCRIPTION_KEY: BooleanOption(page, section, text, detail, invert)
},
default=default,
**kwargs,
)