Merge branch 'feature/calculator-readme-html' into 'master'
Add the README as a user-guide in the calculator application. See merge request cara/cara!73
This commit is contained in:
commit
a233a97334
10 changed files with 5740 additions and 22 deletions
|
|
@ -64,7 +64,7 @@ The window opening distance (in m) is:
|
|||
|
||||
* For hinged windows, it is the distance between the fixed frame and the movable glazed part when open.
|
||||
|
||||

|
||||

|
||||
|
||||
**Notes**: If you are unsure about the opening distance for the window, it is recommended to choose a conservative value (5 cms, 0.05m or 10cms, 0.10m).
|
||||
If you open the window at different distances throughout the day, choose an average value.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import jinja2
|
||||
import mistune
|
||||
from tornado.web import Application, RequestHandler, StaticFileHandler
|
||||
|
||||
from . import model_generator
|
||||
|
|
@ -56,18 +58,28 @@ class LandingPage(RequestHandler):
|
|||
|
||||
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")
|
||||
template = self.settings['template_environment'].get_template("calculator.form.html.j2")
|
||||
report = template.render()
|
||||
self.finish(report)
|
||||
|
||||
|
||||
class ReadmeHandler(RequestHandler):
|
||||
def get(self):
|
||||
template = self.settings['template_environment'].get_template("page.html.j2")
|
||||
markdown = (Path(__file__).parent / 'README.md').read_text()
|
||||
self.write(template.render(
|
||||
active_page="calculator/user-guide",
|
||||
contents=mistune.markdown(markdown)),
|
||||
)
|
||||
|
||||
|
||||
def make_app(debug=False, prefix='/calculator'):
|
||||
static_dir = Path(__file__).absolute().parent.parent / 'static'
|
||||
calculator_static_dir = Path(__file__).absolute().parent / 'static'
|
||||
|
|
@ -77,9 +89,18 @@ def make_app(debug=False, prefix='/calculator'):
|
|||
(prefix + r'/?', CalculatorForm),
|
||||
(prefix + r'/report', ConcentrationModel),
|
||||
(prefix + r'/baseline-model/result', StaticModel),
|
||||
(prefix + r'/user-guide', ReadmeHandler),
|
||||
(prefix + r'/static/(.*)', StaticFileHandler, {'path': calculator_static_dir}),
|
||||
]
|
||||
|
||||
cara_templates = Path(__file__).parent.parent / "templates"
|
||||
calculator_templates = Path(__file__).parent / "templates"
|
||||
template_environment = jinja2.Environment(
|
||||
loader=jinja2.FileSystemLoader([cara_templates, calculator_templates]),
|
||||
)
|
||||
|
||||
return Application(
|
||||
urls,
|
||||
debug=debug,
|
||||
template_environment=template_environment,
|
||||
)
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
|
|
@ -1,8 +1,8 @@
|
|||
{% extends "layout.html.j2" %}
|
||||
|
||||
{% set MODEL_VERSION="BetaV1.1.0" %}
|
||||
{% set CALCULATOR_ACTIVE=1 %}
|
||||
{% set DEBUG=False %}
|
||||
{% set active_page="calculator/" %}
|
||||
|
||||
{% 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">
|
||||
|
|
@ -173,7 +173,10 @@
|
|||
<div style="width: 33%; float:left;">
|
||||
This tool simulates the long range airborne spread SARS-CoV-2 virus in a finite volume and estimates the risk of COVID-19 infection. It is based on current scientific data and can be used to measures the effectiveness of different mitigation measures.<br>
|
||||
|
||||
<b>How to use this tool:</b> <br>
|
||||
For detailed explanations on how to use this tool please see the <a href="/calculator/user-guide"> COVID Calculator user-guide </a>. <br>
|
||||
|
||||
<b>Usage summary:</b> <br>
|
||||
|
||||
<b>Room data</b><br>
|
||||
Enter the data about the area you wish to study. You can find these figures in GIS Portal, or by measuring them yourself.<br>
|
||||
<b>Ventilation data</b> <br>
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 211 KiB |
5662
cara/apps/static/js/js_packaged_for_theme.js
Normal file
5662
cara/apps/static/js/js_packaged_for_theme.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "layout.html.j2" %}
|
||||
{% set HOME_ACTIVE=1 %}
|
||||
{% set active_page="home/" %}
|
||||
|
||||
{% block main %}
|
||||
<div class="field--item">
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@
|
|||
|
||||
|
||||
<header role="banner">
|
||||
|
||||
<div class="header-wrapper">
|
||||
|
||||
|
||||
|
|
@ -137,28 +136,29 @@
|
|||
|
||||
<ul class="nav navbar-nav">
|
||||
<li>
|
||||
<a href="/" data-drupal-link-system-path="<front>" {{ 'class="is-active"' if HOME_ACTIVE else '' }}>Home</a>
|
||||
<a href="/" class="{{ "is-active" if "home/" == active_page else "" }}">
|
||||
Home
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- <li>
|
||||
<a href="/about" title="About the mission" data-drupal-link-system-path="node/2">About</a>
|
||||
</li> -->
|
||||
|
||||
<li>
|
||||
<a href="/calculator" data-drupal-link-system-path="node/22" {{ 'class="is-active"' if CALCULATOR_ACTIVE else '' }}>COVID Calculator</a>
|
||||
</li>
|
||||
|
||||
<!-- <li class="dropdown">
|
||||
<a href="" class="dropdown-toggle" data-drupal-link-system-path="node/7">
|
||||
Tools
|
||||
<span class="caret"></span>
|
||||
<li class="dropdown">
|
||||
<a href="/calculator" class="dropdown-toggle {{ "is-active" if "calculator/" in active_page else "" }}">
|
||||
COVID Calculator
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="/calculator" data-drupal-link-system-path="node/22">COVID Calculator</a>
|
||||
<a href="/calculator" class="{{ "is-active" if "calculator/" == active_page else "" }}">
|
||||
Calculator
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/calculator/user-guide" class="{{ "is-active" if "calculator/user-guide" == active_page else "" }}">
|
||||
User guide
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li> -->
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -289,6 +289,7 @@
|
|||
CERN</div>
|
||||
</footer>
|
||||
|
||||
<script src="/static/js/js_packaged_for_theme.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
|
||||
<script src="/static/js/jquery.colorbox-min.js"></script>
|
||||
<script src="/static/js/ScrollMagic.min.js"></script>
|
||||
|
|
|
|||
28
cara/apps/templates/page.html.j2
Normal file
28
cara/apps/templates/page.html.j2
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{% extends "layout.html.j2" %}
|
||||
|
||||
{% block main %}
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<div class="field--item">
|
||||
<div class="component-row component-row__display__fluidcenter section-navigation effect_none">
|
||||
<div class="component-row__row">
|
||||
<div class="component-row__column component-row__center section-has-no-column col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="box-effects-wrapper ">
|
||||
<div class="text-component text-component-page clearfix">
|
||||
{{ contents }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<a class="endof-cern-header-blocks"></a>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
{% endblock main %}
|
||||
3
setup.py
3
setup.py
|
|
@ -20,8 +20,11 @@ REQUIREMENTS: dict = {
|
|||
'ipykernel',
|
||||
'ipympl',
|
||||
'ipywidgets',
|
||||
'Jinja2',
|
||||
'matplotlib',
|
||||
'mistune',
|
||||
'numpy',
|
||||
'tornado',
|
||||
'voila >=0.2.4',
|
||||
],
|
||||
'app': [],
|
||||
|
|
|
|||
Loading…
Reference in a new issue