From 0c1a53146464c5aacde764e48b4686af306c6d11 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Wed, 23 Mar 2022 13:44:55 +0100 Subject: [PATCH] Added warning on short range when mask on is selected --- cara/apps/calculator/static/js/form.js | 22 +++++++++---------- .../templates/base/calculator.form.html.j2 | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cara/apps/calculator/static/js/form.js b/cara/apps/calculator/static/js/form.js index 17f76700..052c957e 100644 --- a/cara/apps/calculator/static/js/form.js +++ b/cara/apps/calculator/static/js/form.js @@ -242,6 +242,16 @@ function on_wearing_mask_change() { if (this.checked) { getChildElement($(this)).show(); require_fields(this); + if (this.id == "mask_on") { + $('#short_range_no').click(); + $('input[name="short_range_option"]').attr('disabled', true); + $("#short_range_warning").show(); + } + else { + $('input[name="short_range_option"]').attr('disabled', false); + $("#short_range_warning").hide(); + } + } else { getChildElement($(this)).hide(); @@ -256,17 +266,6 @@ function on_short_range_option_change() { if (this.checked) { getChildElement($(this)).show(); require_fields(this); - // Disable face mask selection if short_range_yes is selected - if (this.id == "short_range_yes") { - $('#mask_off').click(); - require_mask(false); - $('input[name="mask_wearing_option"]').attr('disabled', true); - $("#face_mask_warning").show(); - } - else { - $('input[name="mask_wearing_option"]').attr('disabled', false); - $("#face_mask_warning").hide(); - } } else { getChildElement($(this)).hide(); @@ -720,6 +719,7 @@ $(document).ready(function () { // When the short_range_option changes we want to make its respective // children show/hide. $("input[type=radio][name=short_range_option]").change(on_short_range_option_change); + // Call the function now to handle forward/back button presses in the browser. on_short_range_option_change(); diff --git a/cara/apps/templates/base/calculator.form.html.j2 b/cara/apps/templates/base/calculator.form.html.j2 index 6fd11ed5..6adb947e 100644 --- a/cara/apps/templates/base/calculator.form.html.j2 +++ b/cara/apps/templates/base/calculator.form.html.j2 @@ -268,7 +268,6 @@
-

The analytical model with short range interactions does not take mask wearing into account.