mirror of
https://github.com/norohind/jubilant-system.git
synced 2025-04-12 04:40:02 +03:00
web: new pretty design for squad info page
This commit is contained in:
parent
203d859eec
commit
a079cf0f2e
20
templates/table_template_squad_info_by_tag.html
Normal file
20
templates/table_template_squad_info_by_tag.html
Normal 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>
|
@ -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())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user