web: new pretty design for squad info page

This commit is contained in:
norohind 2021-12-16 15:05:41 +03:00
parent 203d859eec
commit a079cf0f2e
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1
2 changed files with 32 additions and 5 deletions

View File

@ -0,0 +1,20 @@
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
{{ @json2html_template.html }}
<link type="text/css" rel="stylesheet" href="/js/table_styles.css">
<title>{{ details_type }} information for {{ tag }}</title>
</head>
<body>
<div id="table0div">
</div>
<div id=footer1div>
<footer>
<a href="/squads/now/by-tag/extended/{{ tag }}?resolve_tags=true&motd=true">Extended information</a>
<a href="/squads/now/by-tag/short/{{ tag }}">Short information</a>
</footer>
</div>
{{ @footer.html }}
</body>
</html>

View File

@ -8,13 +8,21 @@ model.open_model()
class SquadsInfoByTagHtml:
def on_get(self, req: falcon.request.Request, resp: falcon.response.Response, tag: str) -> None:
def on_get(self, req: falcon.request.Request, resp: falcon.response.Response, tag: str, details_type: str) -> None:
resp.content_type = falcon.MEDIA_HTML
details_type = details_type.lower()
if details_type not in ['short', 'extended']:
raise falcon.HTTPBadRequest(description=f'details_type must be one of short, extended')
resp.text = render(
'table_template.html',
'table_template_squad_info_by_tag.html',
{
'target_column_name': 'None',
'target_new_url': ''
'target_new_url': '',
'tag': tag,
'details_type': details_type.title()
}
)
@ -53,8 +61,7 @@ class SquadsInfoByTag:
application = falcon.App()
application.add_route('/squads/now/by-tag/short/{tag}', SquadsInfoByTagHtml())
application.add_route('/squads/now/by-tag/extended/{tag}', SquadsInfoByTagHtml())
application.add_route('/squads/now/by-tag/{details_type}/{tag}', SquadsInfoByTagHtml())
application.add_route('/api/squads/now/by-tag/{details_type}/{tag}', SquadsInfoByTag())