From 7c319aaf555a0db762129ff641f09250ae2829c5 Mon Sep 17 00:00:00 2001 From: Em Barnard-Shao Date: Mon, 23 Dec 2024 12:04:28 -0500 Subject: [PATCH 1/4] Authentication header xsd validations --- app/forms/state_file/state_id_concern.rb | 3 +-- app/lib/submission_builder/authentication_header.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/forms/state_file/state_id_concern.rb b/app/forms/state_file/state_id_concern.rb index 4cd63724c0..98c757593b 100644 --- a/app/forms/state_file/state_id_concern.rb +++ b/app/forms/state_file/state_id_concern.rb @@ -28,8 +28,7 @@ module StateIdConcern validates :id_type, presence: true validates :id_number, presence: true, - # Seems to just be for New York - # alphanumeric: true, length: {is: 9}, + length: { in: 1..40 }, if: -> { id_type != "no_id" } end end diff --git a/app/lib/submission_builder/authentication_header.rb b/app/lib/submission_builder/authentication_header.rb index 301dcec31e..636c90224a 100644 --- a/app/lib/submission_builder/authentication_header.rb +++ b/app/lib/submission_builder/authentication_header.rb @@ -42,7 +42,7 @@ def document xml.IPv6AddressTxt device_info&.ip_address if device_info&.ip_address&.ipv6? end xml.IPTs datetime_type(device_info&.updated_at) - xml.DeviceId device_info&.device_id || 'AB' * 20 + xml.DeviceId /^[A-F0-9]{40}$/.match?(device_info&.device_id) ? device_info&.device_id : 'AB' * 20 xml.DeviceTypeCd 'Browser-based' end xml.TotActiveTimePrepSubmissionTs state_file_total_preparation_submission_minutes From a9c96b552d384df863b5a38f8e22a6fda65f2f64 Mon Sep 17 00:00:00 2001 From: Em Barnard-Shao Date: Mon, 23 Dec 2024 18:40:59 -0500 Subject: [PATCH 2/4] Fix issue where wasn't recognizing more than one question with followup option when page loads --- app/javascript/lib/honeycrisp.js | 16 +++++---- .../primary_state_id/_state_id.html.erb | 36 +++++++++---------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/app/javascript/lib/honeycrisp.js b/app/javascript/lib/honeycrisp.js index 67e9db227e..e6defc98fb 100644 --- a/app/javascript/lib/honeycrisp.js +++ b/app/javascript/lib/honeycrisp.js @@ -103,13 +103,17 @@ var followUpQuestion = (function () { // set initial state of follow-ups based on the page $(this).find('input').each(function (index, input) { - if ($(this).attr('data-follow-up') != null) { - if ($(this).is(':checked')) { - $($(this).attr('data-follow-up')).find('input, select').attr('disabled', false); - $($(this).attr('data-follow-up')).show(); + var $input = $(this); + var followUpSelector = $input.attr('data-follow-up'); + if (followUpSelector) { + if ($input.is(':checked')) { + $(followUpSelector).find('input, select').attr('disabled', false); + $(followUpSelector).show(); } else { - $($(this).attr('data-follow-up')).find('input, select').attr('disabled', true); - $($(this).attr('data-follow-up')).hide(); + if ($('[data-follow-up="' + followUpSelector + '"]:checked').length === 0) { + $(followUpSelector).find('input, select').attr('disabled', true); + $(followUpSelector).hide(); + } } } }); diff --git a/app/views/state_file/questions/primary_state_id/_state_id.html.erb b/app/views/state_file/questions/primary_state_id/_state_id.html.erb index aa065bb1ca..853f6f88a9 100644 --- a/app/views/state_file/questions/primary_state_id/_state_id.html.erb +++ b/app/views/state_file/questions/primary_state_id/_state_id.html.erb @@ -3,22 +3,20 @@ <%= hidden_field_tag "return_to_review", params[:return_to_review] %> <% end %>
-
-
-
- <%= t("state_file.questions.primary_state_id.state_id.id_type_question.label") %> -
- <%= - f.cfa_radio_set( - :id_type, - collection: [ - { value: :driver_license, label: t("state_file.questions.primary_state_id.state_id.id_type_question.drivers_license"), input_html: { "data-follow-up": "#id-details-fields" } }, - { value: :dmv_bmv, label: (options[:dmv_bmv_label] || t("state_file.questions.primary_state_id.state_id.id_type_question.dmv")), input_html: { "data-follow-up": "#id-details-fields" } }, - { value: :no_id, label: (options[:no_id_label] || t("state_file.questions.primary_state_id.state_id.id_type_question.no_id")) }, - ] - ) - %> +
+
+ <%= t("state_file.questions.primary_state_id.state_id.id_type_question.label") %>
+ <%= + f.cfa_radio_set( + :id_type, + collection: [ + { value: :driver_license, label: t("state_file.questions.primary_state_id.state_id.id_type_question.drivers_license"), input_html: { "data-follow-up": "#id-details-fields" } }, + { value: :dmv_bmv, label: (options[:dmv_bmv_label] || t("state_file.questions.primary_state_id.state_id.id_type_question.dmv")), input_html: { "data-follow-up": "#id-details-fields" } }, + { value: :no_id, label: (options[:no_id_label] || t("state_file.questions.primary_state_id.state_id.id_type_question.no_id")) }, + ] + ) + %>