diff --git a/.gitignore b/.gitignore index 5d44b85e..0cca26b7 100644 --- a/.gitignore +++ b/.gitignore @@ -69,3 +69,4 @@ target/ # Noise .DS_Store .sass-cache/ +edivorce/apps/core/static/css/main.css.map diff --git a/edivorce/apps/core/static/js/functions.js b/edivorce/apps/core/static/js/functions.js index a8d8fcd0..f6933db7 100644 --- a/edivorce/apps/core/static/js/functions.js +++ b/edivorce/apps/core/static/js/functions.js @@ -7,15 +7,59 @@ var reveal = function(el) { var id = '#' + el.data("target_id"); var css_class = el.data("target_class"); var related_id = el.data("related_id"); - // hide or show based on target id + var reveal_condition = el.data("reveal_condition"); + var should_reveal = true; + + if (reveal_condition !== undefined) { + should_reveal = false; + if (reveal_condition.startsWith(">=")) { + should_reveal = el.val() >= parseInt(reveal_condition.slice(2), 10); + } else if (reveal_condition.startsWith("<=")) { + should_reveal = el.val() <= parseInt(reveal_condition.slice(2), 10); + } else if (reveal_condition.startsWith("==")) { + should_reveal = el.val() === parseInt(reveal_condition.slice(2), 10); + } else if (reveal_condition.startsWith("<")) { + should_reveal = el.val() < parseInt(reveal_condition.slice(1), 10); + } else if (reveal_condition.startsWith(">")) { + should_reveal = el.val() > parseInt(reveal_condition.slice(1), 10) ; + } + + if (!should_reveal) { + if (related_id !== undefined){ + $('#' + related_id).hide(); + } + if (css_class !== undefined){ + $('.' + css_class).hide(); + } + } + } + + if (should_reveal) { + showHideTargetId(el, id, related_id); + showHideRevealClass(el, css_class); + + if (el.prop('name') === "provide_certificate_later" || el.prop('name') === "original_marriage_certificate") { + if ($('input[name=provide_certificate_later]:checked').val() !== 'YES' && $('input[name=original_marriage_certificate]:checked').val() === 'NO') { + $('#is_certificate_in_english').hide(); + } + else { + $('#is_certificate_in_english').show(); + } + } + } +}; + +// hide or show based on target id +var showHideTargetId = function(el, id, related_id) { if (el.data("reveal_target") === true && el.prop('checked')) { $(id).show(); if (related_id !== undefined){ $('#' + related_id).hide(); } if (id === "#has_children"){ - reveal($("input[name=any_under_19]:checked")); + reveal($("input[name=number_children_over_19]")); } + // reveal nested question as well if (id ==="#marriage_certificate"){ reveal($("input[name=provide_certificate_later]:checked")); @@ -26,24 +70,17 @@ var reveal = function(el) { $('#' + related_id).show(); } } +}; - // hide or show based on target css class +// Controls show or hiding a target css class +var showHideRevealClass = function(el, target_css_class) { if (el.data("reveal_class") === false) { - if (css_class !== undefined){ - $('.' + css_class).hide(); + if (target_css_class !== undefined){ + $('.' + target_css_class).hide(); } } else { - if (css_class !== undefined){ - $('.' + css_class).show(); - } - } - - if (el.prop('name') === "provide_certificate_later" || el.prop('name') === "original_marriage_certificate"){ - if ($('input[name=provide_certificate_later]:checked').val() !== 'YES' && $('input[name=original_marriage_certificate]:checked').val() === 'NO') { - $('#is_certificate_in_english').hide(); - } - else { - $('#is_certificate_in_english').show(); + if (target_css_class !== undefined){ + $('.' + target_css_class).show(); } } }; diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index 07b9c522..f70ccd94 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -50,7 +50,7 @@ $(function () { $(this).parent().find('.radio-with-other').prop('checked', true); }); - $("input[type=radio], input[type=checkbox], input[type=text], .response-textarea, .response-dropdown").on("change", ajaxOnChange); + $("input[type=number], input[type=radio], input[type=checkbox], input[type=text], .response-textarea, .response-dropdown").on("change", ajaxOnChange); // If relationship is common law and they want spousal support, update spouse_support_act with hidden input field, spouse_support_act_common_law if ($("#spouse_support_act_common_law").length) { diff --git a/edivorce/apps/core/templates/prequalification/step_04.html b/edivorce/apps/core/templates/prequalification/step_04.html index 45417ea6..7e5e6c4f 100644 --- a/edivorce/apps/core/templates/prequalification/step_04.html +++ b/edivorce/apps/core/templates/prequalification/step_04.html @@ -193,13 +193,13 @@
+ If you have a child support agreement, you can change it at any time if both of you agree. +
++ If the other party doesn’t agree with a change you want to make, you can apply to court + to set aside all or part of the agreement. The court would then replace it with a court + order. The court may set aside your agreement if it’s different from what the court would + have ordered under the law. +
++ If you have a court order, either party can apply to lower or raise child support payments + if there’s a change in circumstances, such as: +
++ The court can also change the order if: +
++ If you have taken over responsibility for the daily care of a child from the other parent + or guardian, you can apply to change the child support order or agreement so the other parent + or guardian pays you child support. +
+