From 3fe82bcdda822c39b8599d180498721276ad1c4f Mon Sep 17 00:00:00 2001 From: Mike Rotondo Date: Wed, 6 Nov 2024 16:18:25 -0800 Subject: [PATCH] simplify changes to honeycrisp --- app/javascript/lib/honeycrisp.js | 26 ++++--------------- .../questions/id_grocery_credit/edit.html.erb | 2 +- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/app/javascript/lib/honeycrisp.js b/app/javascript/lib/honeycrisp.js index fea3a01a86..d06c3757d2 100644 --- a/app/javascript/lib/honeycrisp.js +++ b/app/javascript/lib/honeycrisp.js @@ -118,32 +118,16 @@ var followUpQuestion = (function () { }); }, update: function ($container) { - let reset_other_follow_ups = $container.attr('data-reset-other-follow-ups') !== "false"; - let hide_other_follow_ups = $container.attr('data-hide-other-follow-ups') !== "false"; - - // reset follow ups - if (reset_other_follow_ups) { - $container.find('.question-with-follow-up__follow-up input').attr('disabled', true); - } - - if (hide_other_follow_ups) { - console.log("hiding followups"); - $container.find('.question-with-follow-up__follow-up').hide(); - } + $container.find('.question-with-follow-up__follow-up input').attr('disabled', true); + $container.find('.question-with-follow-up__follow-up').hide(); $container.find('.question-with-follow-up__question input').each(function (index, input) { // if any of the inputs with a data-follow-up is checked then show the follow-up - if ($(input).attr('data-follow-up') != null) { + if ($(input).is(':checked') && $(input).attr('data-follow-up') != null) { var followUpSelector = $(this).attr('data-follow-up'); if (/^[a-zA-Z0-9_\-#\.]+$/.test(followUpSelector)) { - if ($(input).is(':checked')) { - console.log("showing " + followUpSelector); - $(followUpSelector).show(); - $(followUpSelector).find('input').attr('disabled', false); - } else { - $(followUpSelector).hide(); - $(followUpSelector).find('input').attr('disabled', true); - } + $(followUpSelector).show(); + $(followUpSelector).find('input').attr('disabled', false); } } }); diff --git a/app/views/state_file/questions/id_grocery_credit/edit.html.erb b/app/views/state_file/questions/id_grocery_credit/edit.html.erb index 0fdcd6dd1f..c644aa248f 100644 --- a/app/views/state_file/questions/id_grocery_credit/edit.html.erb +++ b/app/views/state_file/questions/id_grocery_credit/edit.html.erb @@ -8,7 +8,7 @@ <%= form_with model: @form, url: { action: :update }, method: :put, local: true, builder: VitaMinFormBuilder, class: 'form-card' do |f| %> -
+

<%= t(".situations_question") %>