Put the calculator form inside the CARA template.
This commit is contained in:
parent
1c4e24e5ba
commit
a235fb2f5d
5 changed files with 47 additions and 21 deletions
|
|
@ -53,18 +53,32 @@ class LandingPage(RequestHandler):
|
|||
import jinja2
|
||||
p = Path(__file__).parent.parent / "templates"
|
||||
env = jinja2.Environment(loader=jinja2.FileSystemLoader(Path(p)))
|
||||
template = env.get_template("index.html.j2")
|
||||
template = env.get_template("layout.html.j2")
|
||||
report = template.render(**{})
|
||||
self.finish(report)
|
||||
|
||||
|
||||
class CalculatorForm(RequestHandler):
|
||||
def get(self):
|
||||
import jinja2
|
||||
cara_templates = Path(__file__).parent.parent / "templates"
|
||||
calculator_templates = Path(__file__).parent / "templates"
|
||||
env = jinja2.Environment(
|
||||
loader=jinja2.FileSystemLoader([cara_templates, calculator_templates]),
|
||||
)
|
||||
|
||||
template = env.get_template("calculator.form.html.j2")
|
||||
report = template.render()
|
||||
self.finish(report)
|
||||
|
||||
|
||||
def make_app(debug=False, prefix='/calculator'):
|
||||
static_dir = Path(__file__).absolute().parent.parent / 'static'
|
||||
calculator_static_dir = Path(__file__).absolute().parent / 'static'
|
||||
urls = [
|
||||
(r'/?', LandingPage),
|
||||
(r'/static/(.*)', StaticFileHandler, {'path': static_dir}),
|
||||
(prefix + r'/?()', StaticFileHandler, {'path': calculator_static_dir / 'form.html'}),
|
||||
(prefix + r'/?', CalculatorForm),
|
||||
(prefix + r'/report', ConcentrationModel),
|
||||
(prefix + r'/baseline-model/result', StaticModel),
|
||||
(prefix + r'/static/(.*)', StaticFileHandler, {'path': calculator_static_dir}),
|
||||
|
|
|
|||
|
|
@ -93,9 +93,10 @@ def build_report(model: models.Model, form: FormData):
|
|||
|
||||
context.update(calculate_report_data(model))
|
||||
|
||||
p = Path(__file__).parent / "templates"
|
||||
cara_templates = Path(__file__).parent.parent / "templates"
|
||||
calculator_templates = Path(__file__).parent / "templates"
|
||||
env = jinja2.Environment(
|
||||
loader=jinja2.FileSystemLoader(Path(p)),
|
||||
loader=jinja2.FileSystemLoader([cara_templates, calculator_templates]),
|
||||
undefined=jinja2.StrictUndefined,
|
||||
)
|
||||
env.filters['minutes_to_time'] = minutes_to_time
|
||||
|
|
|
|||
|
|
@ -146,12 +146,10 @@ function show_disclaimer() {
|
|||
dots.style.display = "inline";
|
||||
btnText.innerHTML = "Read more";
|
||||
moreText.style.display = "none";
|
||||
$("#DIALOG_welcome").dialog("option", "height", 185);
|
||||
} else {
|
||||
dots.style.display = "none";
|
||||
btnText.innerHTML = "Read less";
|
||||
moreText.style.display = "inline";
|
||||
$("#DIALOG_welcome").dialog("option", "height", 600);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
{% extends "layout.html.j2" %}
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
|
||||
{% block extra_headers %}
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" integrity="sha512-aOG0c6nPNzGk+5zjwyJaoRUgCdOrfSDhmMID2u4+OIslr0GjpLKo7Xm0Ao3xmpM4T8AmIouRkqwj1nrdVsLKEQ==" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="/calculator/static/css/form.css">
|
||||
{% endblock extra_headers %}
|
||||
|
||||
{% block body_scripts %}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" integrity="sha512-uto9mlQzrs59VwILcLiRYeLKPPbS/bT71da/OEBYEwcdNUk8jYIy+D176RYoop1Da+f9mvkYrmj5MCLZWEtQuA==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" src="/calculator/static/js/form.js"></script>
|
||||
<script src="/calculator/static/js/form.js"></script>
|
||||
{% endblock body_scripts %}
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" integrity="sha512-aOG0c6nPNzGk+5zjwyJaoRUgCdOrfSDhmMID2u4+OIslr0GjpLKo7Xm0Ao3xmpM4T8AmIouRkqwj1nrdVsLKEQ==" crossorigin="anonymous"/>
|
||||
<link rel="stylesheet" href="/calculator/static/css/form.css"/>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% block main %}
|
||||
<div style="margin: 2em;">
|
||||
<div class="text-component text-component-page clearfix"></div>
|
||||
<div style="height: 8em; display: block;"></div>
|
||||
|
||||
Beta v1.0.0 <span style="float:right; font-weight:bold">Please send feedback to <a href="mailto:CARA-dev@cern.ch">CARA-dev@cern.ch</a></span>
|
||||
<h1> <p><b>CARA</b> Covid Airborne Risk Assessment tool</p></h1>
|
||||
|
|
@ -185,5 +186,7 @@ You should specify if the event is a one off (give date) or recurrent use of the
|
|||
<button onclick="show_disclaimer()" id="myBtn">Read more</button><br><br>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<div class="text-component text-component-page clearfix"></div>
|
||||
<br>
|
||||
</div>
|
||||
{% endblock main %}
|
||||
|
|
@ -10,13 +10,21 @@
|
|||
<meta name="HandheldFriendly" content="true">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Welcome | CARA</title>
|
||||
<title>
|
||||
{% block title %}
|
||||
CARA | COVID Airborne Risk Assessment
|
||||
{% endblock title %}
|
||||
</title>
|
||||
|
||||
<link rel="stylesheet" media="all" href="/static/css/cern-theme.css">
|
||||
<link rel="stylesheet" media="all" href="/static/css/cern-theme2.css">
|
||||
<link rel="stylesheet" media="all" href="/static/css/cern-theme3.css">
|
||||
<link rel="stylesheet" media="all" href="/static/css/colorbox.css">
|
||||
<link rel="stylesheet" media="all" href="/static/css/cern-theme4.css">
|
||||
|
||||
{% block extra_headers %}
|
||||
{% endblock extra_headers %}
|
||||
|
||||
</head>
|
||||
|
||||
<body
|
||||
|
|
@ -324,6 +332,8 @@
|
|||
<script src="/static/js/ScrollMagic.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/js/bootstrap.min.js" integrity="sha512-8qmis31OQi6hIRgvkht0s6mCOittjMa9GMqtK9hes5iEQBQE/Ca6yGE5FsW36vyipGoWQswBj/QBm2JR086Rkw==" crossorigin="anonymous"></script>
|
||||
<script src="/static/js/usage-tracking.js"></script>
|
||||
{% block body_scripts %}
|
||||
{% endblock body_scripts %}
|
||||
|
||||
<div id="cboxOverlay" style="display: none;"></div>
|
||||
<div id="colorbox" class="" role="dialog" tabindex="-1" style="display: none;">
|
||||
Loading…
Reference in a new issue