From 400c023079d020575b8b7fdc08c26caff8358d57 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Fri, 17 Mar 2023 12:07:14 +0100 Subject: [PATCH 01/10] restricted mypy version --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 2d27b2e8..3d795bd6 100644 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ REQUIREMENTS: dict = { 'test': [ 'pytest', 'pytest-mypy != v0.10.1', + 'mypy != 1.1.1', 'pytest-tornasync', 'numpy-stubs @ git+https://github.com/numpy/numpy-stubs.git', 'types-dataclasses', From ae54c55872a98ac784027bdd38eac3705efa236f Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Fri, 17 Mar 2023 12:07:56 +0100 Subject: [PATCH 02/10] adapted code to receive an APPLICATION_ROOT --- caimira/apps/calculator/__init__.py | 75 ++++++++++++++++++----------- caimira/apps/calculator/__main__.py | 7 ++- 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/caimira/apps/calculator/__init__.py b/caimira/apps/calculator/__init__.py index 2f42bd0d..45851fee 100644 --- a/caimira/apps/calculator/__init__.py +++ b/caimira/apps/calculator/__init__.py @@ -73,7 +73,8 @@ class BaseRequestHandler(RequestHandler): print(traceback.format_exc()) self.finish(template.render( user=self.current_user, - calculator_prefix=self.settings["calculator_prefix"], + get_url = template.globals['get_url'], + get_calculator_url = template.globals["get_calculator_url"], active_page='Error', contents=contents )) @@ -87,7 +88,8 @@ class Missing404Handler(BaseRequestHandler): "page.html.j2") self.finish(template.render( user=self.current_user, - calculator_prefix=self.settings["calculator_prefix"], + get_url = template.globals['get_url'], + get_calculator_url = template.globals["get_calculator_url"], active_page='Error', contents='Unfortunately the page you were looking for does not exist.



' )) @@ -193,8 +195,9 @@ class LandingPage(BaseRequestHandler): "index.html.j2") report = template.render( user=self.current_user, - calculator_prefix=self.settings["calculator_prefix"], - text_blocks=template_environment.globals['common_text'], + get_url = template_environment.globals['get_url'], + get_calculator_url = template_environment.globals['get_calculator_url'], + text_blocks=template_environment.globals["common_text"], ) self.finish(report) @@ -205,9 +208,10 @@ class AboutPage(BaseRequestHandler): template = template_environment.get_template("about.html.j2") report = template.render( user=self.current_user, - calculator_prefix=self.settings["calculator_prefix"], + get_url = template.globals['get_url'], + get_calculator_url = template.globals["get_calculator_url"], active_page="about", - text_blocks=template_environment.globals['common_text'] + text_blocks=template_environment.globals["common_text"] ) self.finish(report) @@ -220,9 +224,10 @@ class CalculatorForm(BaseRequestHandler): report = template.render( user=self.current_user, xsrf_form_html=self.xsrf_form_html(), - calculator_prefix=self.settings["calculator_prefix"], + get_url = template.globals['get_url'], + get_calculator_url = template.globals["get_calculator_url"], calculator_version=__version__, - text_blocks=template_environment.globals['common_text'], + text_blocks=template_environment.globals["common_text"], ) self.finish(report) @@ -236,8 +241,9 @@ class CompressedCalculatorFormInputs(BaseRequestHandler): except Exception as err: # noqa self.set_status(400) return self.finish("Invalid calculator data: it seems incomplete. Was there an error copying & pasting the URL?") - self.redirect(f'{self.settings["calculator_prefix"]}?{args}') - + template_environment = self.settings["template_environment"] + self.redirect(f'{template_environment.globals["get_calculator_url"]()}?{args}') + class ReadmeHandler(BaseRequestHandler): def get(self): @@ -246,8 +252,9 @@ class ReadmeHandler(BaseRequestHandler): readme = template.render( active_page="calculator/user-guide", user=self.current_user, - calculator_prefix=self.settings["calculator_prefix"], - text_blocks=template_environment.globals['common_text'], + get_url = template.globals['get_url'], + get_calculator_url = template.globals["get_calculator_url"], + text_blocks=template_environment.globals["common_text"], ) self.finish(readme) @@ -337,28 +344,39 @@ class CasesData(BaseRequestHandler): # If any of the 'New_cases' is 0, it means the data is not updated. if (cases.loc[eight_days_ago:current_date]['New_cases'] == 0).any(): return self.finish('') return self.finish(str(round(cases.loc[eight_days_ago:current_date]['New_cases'].mean()))) + +def get_url(app_root: str, relative_path: str = '/'): + return app_root.rstrip('/') + relative_path.rstrip('/') + +def get_calculator_url(app_root: str, calculator_prefix: str, relative_path: str = '/'): + return app_root.rstrip('/') + calculator_prefix + relative_path.rstrip('/') def make_app( debug: bool = False, + APPLICATION_ROOT: str = '/', calculator_prefix: str = '/calculator', theme_dir: typing.Optional[Path] = None, ) -> Application: static_dir = Path(__file__).absolute().parent.parent / 'static' calculator_static_dir = Path(__file__).absolute().parent / 'static' + + get_root_url = functools.partial(get_url, APPLICATION_ROOT) + get_root_calculator_url = functools.partial(get_calculator_url, APPLICATION_ROOT, calculator_prefix) + urls: typing.Any = [ - (r'/?', LandingPage), - (r'/_c/(.*)', CompressedCalculatorFormInputs), - (r'/about', AboutPage), - (r'/static/(.*)', StaticFileHandler, {'path': static_dir}), - (calculator_prefix + r'/?', CalculatorForm), - (calculator_prefix + r'/report', ConcentrationModel), - (calculator_prefix + r'/report-json', ConcentrationModelJsonResponse), - (calculator_prefix + r'/baseline-model/result', StaticModel), - (calculator_prefix + r'/user-guide', ReadmeHandler), - (calculator_prefix + r'/api/arve/v1/(.*)/(.*)', ArveData), - (calculator_prefix + r'/cases/(.*)', CasesData), - (calculator_prefix + r'/static/(.*)', StaticFileHandler, {'path': calculator_static_dir}), + (get_root_url(r'/?'), LandingPage), + (get_root_url(r'/_c/(.*)'), CompressedCalculatorFormInputs), + (get_root_url(r'/about'), AboutPage), + (get_root_url(r'/static/(.*)'), StaticFileHandler, {'path': static_dir}), + (get_root_calculator_url(r'/?'), CalculatorForm), + (get_root_calculator_url(r'/report'), ConcentrationModel), + (get_root_calculator_url(r'/report-json'), ConcentrationModelJsonResponse), + (get_root_calculator_url(r'/baseline-model/result'), StaticModel), + (get_root_calculator_url(r'/user-guide'), ReadmeHandler), + (get_root_calculator_url(r'/api/arve/v1/(.*)/(.*)'), ArveData), + (get_root_calculator_url(r'/cases/(.*)'), CasesData), + (get_root_calculator_url(r'/static/(.*)'), StaticFileHandler, {'path': calculator_static_dir}), ] caimira_templates = Path(__file__).parent.parent / "templates" @@ -372,9 +390,11 @@ def make_app( undefined=jinja2.StrictUndefined, # fail when rendering any undefined template context variable ) - template_environment.globals['common_text'] = markdown_tools.extract_rendered_markdown_blocks( + template_environment.globals["common_text"] = markdown_tools.extract_rendered_markdown_blocks( template_environment.get_template('common_text.md.j2') ) + template_environment.globals['get_url']=get_root_url + template_environment.globals['get_calculator_url']=get_root_calculator_url if debug: tornado.log.enable_pretty_logging() @@ -382,10 +402,11 @@ def make_app( return Application( urls, debug=debug, - calculator_prefix=calculator_prefix, + # calculator_prefix=calculator_prefix, + # APPLICATION_ROOT=APPLICATION_ROOT, template_environment=template_environment, default_handler_class=Missing404Handler, - report_generator=ReportGenerator(loader, calculator_prefix), + report_generator=ReportGenerator(loader, get_root_url, get_root_calculator_url), xsrf_cookies=True, # COOKIE_SECRET being undefined will result in no login information being # presented to the user. diff --git a/caimira/apps/calculator/__main__.py b/caimira/apps/calculator/__main__.py index 7ec8b69a..d9c46bd5 100644 --- a/caimira/apps/calculator/__main__.py +++ b/caimira/apps/calculator/__main__.py @@ -16,6 +16,11 @@ def configure_parser(parser) -> argparse.ArgumentParser: help="A directory containing extensions for templates and static data", default=None, ) + parser.add_argument( + "--app_root", + help="Change the APPLICATION_ROOT of the app", + default="/" + ) parser.add_argument( "--prefix", help="Change the URL path prefix to the calculator app", @@ -36,7 +41,7 @@ def main(): if theme_dir is not None: theme_dir = Path(theme_dir).absolute() assert theme_dir.exists() - app = make_app(debug=args.no_debug, calculator_prefix=args.prefix, theme_dir=theme_dir) + app = make_app(debug=args.no_debug, APPLICATION_ROOT=args.app_root, calculator_prefix=args.prefix, theme_dir=theme_dir) app.listen(args.port) IOLoop.instance().start() From 1146cf76c984991a8133d437f3776826e505658a Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Fri, 17 Mar 2023 12:08:58 +0100 Subject: [PATCH 03/10] modified templates to consider a relative path --- caimira/apps/calculator/report_generator.py | 18 ++++++----- caimira/apps/templates/about.html.j2 | 4 +-- .../templates/base/calculator.form.html.j2 | 20 ++++++------- .../templates/base/calculator.report.html.j2 | 14 ++++----- caimira/apps/templates/base/index.html.j2 | 12 ++++---- caimira/apps/templates/base/layout.html.j2 | 30 +++++++++---------- .../templates/cern/calculator.report.html.j2 | 2 +- caimira/apps/templates/cern/index.html.j2 | 2 +- 8 files changed, 52 insertions(+), 50 deletions(-) diff --git a/caimira/apps/calculator/report_generator.py b/caimira/apps/calculator/report_generator.py index 81a64543..1dcfa00d 100644 --- a/caimira/apps/calculator/report_generator.py +++ b/caimira/apps/calculator/report_generator.py @@ -155,7 +155,7 @@ def calculate_report_data(form: FormData, model: models.ExposureModel) -> typing } -def generate_permalink(base_url, calculator_prefix, form: FormData): +def generate_permalink(base_url, get_root_url, get_root_calculator_url, form: FormData): form_dict = FormData.to_dict(form, strip_defaults=True) # Generate the calculator URL arguments that would be needed to re-create this @@ -165,8 +165,8 @@ def generate_permalink(base_url, calculator_prefix, form: FormData): # Then zlib compress + base64 encode the string. To be inverted by the # /_c/ endpoint. compressed_args = base64.b64encode(zlib.compress(args.encode())).decode() - qr_url = f"{base_url}/_c/{compressed_args}" - url = f"{base_url}{calculator_prefix}?{args}" + qr_url = f"{base_url}{get_root_url()}/_c/{compressed_args}" + url = f"{base_url}{get_root_calculator_url()}?{args}" return { 'link': url, @@ -342,7 +342,8 @@ def comparison_report( @dataclasses.dataclass class ReportGenerator: jinja_loader: jinja2.BaseLoader - calculator_prefix: str + get_root_url: typing.Any + get_root_calculator_url: typing.Any def build_report( self, @@ -377,8 +378,9 @@ class ReportGenerator: context['alternative_scenarios'] = comparison_report( form, report_data, alternative_scenarios, scenario_sample_times, executor_factory=executor_factory, ) - context['permalink'] = generate_permalink(base_url, self.calculator_prefix, form) - context['calculator_prefix'] = self.calculator_prefix + context['permalink'] = generate_permalink(base_url, self.get_root_url, self.get_root_calculator_url, form) + context['get_url'] = self.get_root_url + context['get_calculator_url'] = self.get_root_calculator_url return context @@ -387,7 +389,7 @@ class ReportGenerator: loader=self.jinja_loader, undefined=jinja2.StrictUndefined, ) - env.globals['common_text'] = markdown_tools.extract_rendered_markdown_blocks( + env.globals["common_text"] = markdown_tools.extract_rendered_markdown_blocks( env.get_template('common_text.md.j2') ) env.filters['non_zero_percentage'] = non_zero_percentage @@ -401,4 +403,4 @@ class ReportGenerator: def render(self, context: dict) -> str: template = self._template_environment().get_template("calculator.report.html.j2") - return template.render(**context, text_blocks=template.globals['common_text']) + return template.render(**context, text_blocks=template.globals["common_text"]) diff --git a/caimira/apps/templates/about.html.j2 b/caimira/apps/templates/about.html.j2 index 2ecce51d..606710b8 100644 --- a/caimira/apps/templates/about.html.j2 +++ b/caimira/apps/templates/about.html.j2 @@ -14,8 +14,8 @@ For information on the Airborne Transmission of SARS-CoV-2, feel free to check o CAiMIRA stands for CERN Airborne Model for Indoor Risk Assessment, previously known as CARA - COVID Airborne Risk Assessment, developed in the spring of 2020 to better understand and quantify the risk of long-range airborne spread of SARS-CoV-2 virus in workplaces. Since then, the model has evolved and now is capable of simulating the short-range component. CAiMIRA comes with different applications that allow more or less flexibility in the input parameters: The mathematical and physical model simulate the airborne spread of SARS-CoV-2 virus in a finite volume, assuming a homogenous mixture and a two-stage exhaled jet model, and estimates the risk of COVID-19 airborne transmission therein. The results DO NOT include other known modes of SARS-CoV-2 transmission. Hence, the output from this model is only valid when the other recommended public health & safety instructions are observed, such as good hand hygiene and other barrier measures.
diff --git a/caimira/apps/templates/base/calculator.form.html.j2 b/caimira/apps/templates/base/calculator.form.html.j2 index 06ad852a..fb25af92 100644 --- a/caimira/apps/templates/base/calculator.form.html.j2 +++ b/caimira/apps/templates/base/calculator.form.html.j2 @@ -5,13 +5,13 @@ {% block extra_headers %} - + {% endblock extra_headers %} {% block body_scripts %} - + {% endblock body_scripts %} @@ -21,7 +21,7 @@ {% if DEBUG %}
{% else %} - + {% endif %} {{ xsrf_form_html }} @@ -31,7 +31,7 @@

Calculator

- +
@@ -222,7 +222,7 @@ If these conditions are not met, the air exchange might not be homogenous producing an artificially lower risk further away from the window.

- + @@ -327,14 +327,14 @@
@@ -342,7 +342,7 @@ @@ -717,13 +717,13 @@
  • If coffee breaks are included, they are spread out evenly throughout the day, in addition to any lunch break (if applicable).
  • - Refer to Calculator App user guide + Refer to Calculator App user guide for more detailed explanations on how to use this tool.
    {% block covid_information%} {% endblock covid_information%} @@ -85,7 +85,7 @@
    - Logo + Logo

    CERN strives to deploy its know-how and technologies to help solve the challenges arising in the local and global fight against COVID-19. As a particle physics research organisation, CERN is not in a position to advise on medical research, health or health @@ -103,17 +103,17 @@

    - + - - + + - + - + - + {% block body_scripts %} {% endblock body_scripts %} diff --git a/caimira/apps/templates/cern/calculator.report.html.j2 b/caimira/apps/templates/cern/calculator.report.html.j2 index 7a50d768..5176d5b2 100644 --- a/caimira/apps/templates/cern/calculator.report.html.j2 +++ b/caimira/apps/templates/cern/calculator.report.html.j2 @@ -181,7 +181,7 @@
    -
    +

    diff --git a/caimira/apps/templates/cern/index.html.j2 b/caimira/apps/templates/cern/index.html.j2 index 1dba0804..149d2c3f 100644 --- a/caimira/apps/templates/cern/index.html.j2 +++ b/caimira/apps/templates/cern/index.html.j2 @@ -5,7 +5,7 @@

    CAiMIRA has been developed by CERN with the intention of allowing members of personnel with roles related to supervision, health & safety or space management to simulate the concerned workplaces on CERN sites. - A hosted CERN version of the CAiMIRA Calculator is available on this site to members of the CERN personnel. + A hosted CERN version of the CAiMIRA Calculator is available on this site to members of the CERN personnel.

    {% endblock caimira_at_cern %} \ No newline at end of file From 24e530cb11cfcbc1cf7cb6a8a0b14ebce8a9d486 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Fri, 17 Mar 2023 12:09:15 +0100 Subject: [PATCH 04/10] adapted test test_webapp.py --- caimira/tests/apps/calculator/test_webapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caimira/tests/apps/calculator/test_webapp.py b/caimira/tests/apps/calculator/test_webapp.py index be604f0a..6dc7d692 100644 --- a/caimira/tests/apps/calculator/test_webapp.py +++ b/caimira/tests/apps/calculator/test_webapp.py @@ -103,7 +103,7 @@ class TestOpenApp(tornado.testing.AsyncHTTPTestCase): async def test_permalink_urls(http_server_client, baseline_form): base_url = 'proto://hostname/prefix' - permalink_data = generate_permalink(base_url, "/calculator", baseline_form) + permalink_data = generate_permalink(base_url, lambda: "", lambda: "/calculator", baseline_form) expected = f'{base_url}/calculator?exposed_coffee_break_option={baseline_form.exposed_coffee_break_option}&' assert permalink_data['link'].startswith(expected) From 9277136a8e377b4c8b63eb18cacbbdbf44d32fb2 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Fri, 17 Mar 2023 15:36:22 +0100 Subject: [PATCH 05/10] added env variable to app-config files --- app-config/caimira-webservice/app.sh | 7 +++++-- app-config/docker-compose.yml | 2 ++ app-config/openshift/deploymentconfig.yaml | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app-config/caimira-webservice/app.sh b/app-config/caimira-webservice/app.sh index 0d0452c8..40380a7e 100755 --- a/app-config/caimira-webservice/app.sh +++ b/app-config/caimira-webservice/app.sh @@ -6,13 +6,16 @@ if [[ "$APP_NAME" == "caimira-webservice" ]]; then args+=("--no-debug") fi - if [ ! -z "$CAIMIRA_THEME" ]; then - args+=("--theme=${CAIMIRA_THEME}") + if [ ! -z "$APPLICATION_ROOT" ]; then + args+=("--app_root=${APPLICATION_ROOT}") fi if [ ! -z "$CAIMIRA_CALCULATOR_PREFIX" ]; then args+=("--prefix=${CAIMIRA_CALCULATOR_PREFIX}") fi + if [ ! -z "$CAIMIRA_THEME" ]; then + args+=("--theme=${CAIMIRA_THEME}") + fi export "ARVE_API_KEY"="$ARVE_API_KEY" export "ARVE_CLIENT_ID"="$ARVE_CLIENT_ID" diff --git a/app-config/docker-compose.yml b/app-config/docker-compose.yml index cb9d3958..b2046c21 100644 --- a/app-config/docker-compose.yml +++ b/app-config/docker-compose.yml @@ -11,6 +11,7 @@ services: environment: - COOKIE_SECRET - APP_NAME=caimira-webservice + - APPLICATION_ROOT=/ - CAIMIRA_CALCULATOR_PREFIX=/calculator-cern - CAIMIRA_THEME=caimira/apps/templates/cern user: ${CURRENT_UID} @@ -20,6 +21,7 @@ services: environment: - COOKIE_SECRET - APP_NAME=caimira-webservice + - APPLICATION_ROOT=/ - CAIMIRA_CALCULATOR_PREFIX=/calculator-open user: ${CURRENT_UID} diff --git a/app-config/openshift/deploymentconfig.yaml b/app-config/openshift/deploymentconfig.yaml index 5e23cede..456a2d4b 100644 --- a/app-config/openshift/deploymentconfig.yaml +++ b/app-config/openshift/deploymentconfig.yaml @@ -205,6 +205,8 @@ value: '3' - name: APP_NAME value: caimira-webservice + - name: APPLICATION_ROOT + value: / - name: CAIMIRA_CALCULATOR_PREFIX value: /calculator-cern - name: CAIMIRA_THEME @@ -297,6 +299,8 @@ env: - name: APP_NAME value: caimira-webservice + - name: APPLICATION_ROOT + value: / - name: CAIMIRA_CALCULATOR_PREFIX value: /calculator-open image: '${PROJECT_NAME}/caimira-webservice' From b5586bb74864b57a7d0c08a32b197d347642b037 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Fri, 17 Mar 2023 15:36:34 +0100 Subject: [PATCH 06/10] fixed paths on templates --- caimira/apps/templates/about.html.j2 | 2 +- caimira/apps/templates/base/index.html.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/caimira/apps/templates/about.html.j2 b/caimira/apps/templates/about.html.j2 index 606710b8..36ea62e8 100644 --- a/caimira/apps/templates/about.html.j2 +++ b/caimira/apps/templates/about.html.j2 @@ -15,7 +15,7 @@ CAiMIRA stands for CERN Airborne Model for Indoor Risk Assessment, previously kn Since then, the model has evolved and now is capable of simulating the short-range component. CAiMIRA comes with different applications that allow more or less flexibility in the input parameters: The mathematical and physical model simulate the airborne spread of SARS-CoV-2 virus in a finite volume, assuming a homogenous mixture and a two-stage exhaled jet model, and estimates the risk of COVID-19 airborne transmission therein. The results DO NOT include other known modes of SARS-CoV-2 transmission. Hence, the output from this model is only valid when the other recommended public health & safety instructions are observed, such as good hand hygiene and other barrier measures.
    diff --git a/caimira/apps/templates/base/index.html.j2 b/caimira/apps/templates/base/index.html.j2 index 0b247cc0..2f2c5457 100644 --- a/caimira/apps/templates/base/index.html.j2 +++ b/caimira/apps/templates/base/index.html.j2 @@ -50,7 +50,7 @@

    About

    -
    About page for details on methodology, assumptions and limitations of CAiMIRA.
    +
    About page for details on methodology, assumptions and limitations of CAiMIRA.

    Documentation

    From 60f3afe1e530cdda7a69910672cabf398e35b12c Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Mon, 20 Mar 2023 08:32:16 +0000 Subject: [PATCH 07/10] added readme instruction for running the app with an application_root path --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 9318bd60..6ae24d2b 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,12 @@ To run with a specific template theme created: python -m caimira.apps.calculator --theme=caimira/apps/templates/{theme} ``` +To run the entire app in a different `APPLICATION_ROOT` path: + +``` +python -m caimira.apps.calculator --app_root=/myroot +``` + To run the calculator on a different URL path: ``` From b010c5348f50491e80af6fa8b12a6f293d51fe63 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Mon, 20 Mar 2023 15:54:33 +0000 Subject: [PATCH 08/10] added missing rstrip to calculator prefix --- caimira/apps/calculator/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caimira/apps/calculator/__init__.py b/caimira/apps/calculator/__init__.py index 45851fee..c36e56ec 100644 --- a/caimira/apps/calculator/__init__.py +++ b/caimira/apps/calculator/__init__.py @@ -350,7 +350,7 @@ def get_url(app_root: str, relative_path: str = '/'): return app_root.rstrip('/') + relative_path.rstrip('/') def get_calculator_url(app_root: str, calculator_prefix: str, relative_path: str = '/'): - return app_root.rstrip('/') + calculator_prefix + relative_path.rstrip('/') + return app_root.rstrip('/') + calculator_prefix.rstrip('/') + relative_path.rstrip('/') def make_app( debug: bool = False, From 57f125b07295a9ab24f89fcbdbcac8bdbba26aea Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Tue, 21 Mar 2023 09:18:39 +0000 Subject: [PATCH 09/10] added relative paths to the functions --- .../templates/base/calculator.form.html.j2 | 14 +++++++------- .../templates/base/calculator.report.html.j2 | 16 ++++++++-------- caimira/apps/templates/base/index.html.j2 | 10 +++++----- caimira/apps/templates/base/layout.html.j2 | 18 +++++++++--------- .../templates/cern/calculator.report.html.j2 | 2 +- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/caimira/apps/templates/base/calculator.form.html.j2 b/caimira/apps/templates/base/calculator.form.html.j2 index fb25af92..448350b7 100644 --- a/caimira/apps/templates/base/calculator.form.html.j2 +++ b/caimira/apps/templates/base/calculator.form.html.j2 @@ -5,13 +5,13 @@ {% block extra_headers %} - + {% endblock extra_headers %} {% block body_scripts %} - + {% endblock body_scripts %} @@ -31,7 +31,7 @@

    Calculator

    - +
    @@ -222,7 +222,7 @@ If these conditions are not met, the air exchange might not be homogenous producing an artificially lower risk further away from the window.

    - +
    @@ -327,14 +327,14 @@
    @@ -342,7 +342,7 @@ diff --git a/caimira/apps/templates/base/calculator.report.html.j2 b/caimira/apps/templates/base/calculator.report.html.j2 index 261bd2da..7c202f6f 100644 --- a/caimira/apps/templates/base/calculator.report.html.j2 +++ b/caimira/apps/templates/base/calculator.report.html.j2 @@ -6,12 +6,12 @@ Report | CAiMIRA (CERN Airborne Model for Indoor Risk Assessment) - + - - + + - + @@ -26,7 +26,7 @@ {% block report_header %}
    - +

    REPORT - {{ form.simulation_name }}

    Created {{ creation_date }} using CAiMIRA calculator version v{{ form.calculator_version }}

    @@ -85,7 +85,7 @@ {% endif %}
    - +
    {% block long_range_warning_animation %}
    @@ -106,7 +106,7 @@ With short-range interactions
    - +
    {% block warning_animation %}
    @@ -609,7 +609,7 @@


    {% block disclaimer %} -

    Disclaimer:

    +

    Disclaimer:

    {{ text_blocks['Disclaimer'] }} {% endblock disclaimer %}
    diff --git a/caimira/apps/templates/base/index.html.j2 b/caimira/apps/templates/base/index.html.j2 index 2f2c5457..835bb7fa 100644 --- a/caimira/apps/templates/base/index.html.j2 +++ b/caimira/apps/templates/base/index.html.j2 @@ -4,8 +4,8 @@ {% block main %}
    - - + +
    @@ -20,7 +20,7 @@

    CAiMIRA is a risk assessment tool developed to model the concentration of viruses in enclosed spaces, in order to inform space-management decisions. It does this by simulating the airborne spread SARS-CoV-2 virus in a finite volume, assuming homogenous mixing for the long-range component and a two-stage jet model for short-range, and estimates the risk of COVID-19 airborne transmission therein. - Please see the About page for more details on the methodology, assumptions and limitations of CAiMIRA. + Please see the About page for more details on the methodology, assumptions and limitations of CAiMIRA.

    The full CAiMIRA source code can be accessed freely under an Apache 2.0 open source license from our code repository. @@ -38,7 +38,7 @@

    - +
    @@ -50,7 +50,7 @@

    About

    -
    About page for details on methodology, assumptions and limitations of CAiMIRA.
    +
    About page for details on methodology, assumptions and limitations of CAiMIRA.

    Documentation

    diff --git a/caimira/apps/templates/base/layout.html.j2 b/caimira/apps/templates/base/layout.html.j2 index f878feed..d279117f 100644 --- a/caimira/apps/templates/base/layout.html.j2 +++ b/caimira/apps/templates/base/layout.html.j2 @@ -14,10 +14,10 @@ - + - + {% block extra_headers %} {% endblock extra_headers %} @@ -28,7 +28,7 @@