1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

add Greeting modal component

This commit is contained in:
checktheroads
2020-04-16 00:26:23 -07:00
parent 2cc153d078
commit dffdffdab4
7 changed files with 262 additions and 89 deletions

View File

@@ -391,6 +391,12 @@ def _build_vrf_help():
return all_help
content_greeting = get_markdown(
config_path=params.web.greeting,
default="",
params={"title": params.web.greeting.title},
)
content_vrf = _build_vrf_help()
content_help_params = copy.copy(content_params)
@@ -436,6 +442,7 @@ _frontend_params.update(
"terms": content_terms,
"credit": content_credit,
"vrf": content_vrf,
"greeting": content_greeting,
},
}
)

View File

@@ -69,6 +69,23 @@ class HelpMenu(HyperglassModel):
title: StrictStr = "Help"
class Greeting(HyperglassModel):
"""Validation model for greeting modal."""
enable: StrictBool = False
file: Optional[FilePath]
title: StrictStr = "Welcome"
button: StrictStr = "Continue"
required: StrictBool = False
@validator("file")
def validate_file(cls, value, values):
"""Ensure file is specified if greeting is enabled."""
if values["enable"] and value is None:
raise ValueError("Greeting is enabled, but no file is specified.")
return value
class Logo(HyperglassModel):
"""Validation model for logo configuration."""
@@ -214,6 +231,7 @@ class Web(HyperglassModel):
credit: Credit = Credit()
dns_provider: DnsOverHttps = DnsOverHttps()
external_link: ExternalLink = ExternalLink()
greeting: Greeting = Greeting()
help_menu: HelpMenu = HelpMenu()
logo: Logo = Logo()
opengraph: OpenGraph = OpenGraph()