Skip to content

Commit

Permalink
bs4 review app fixes (#4188)
Browse files Browse the repository at this point in the history
* update reason translation, remove required logic on dds and helper, update dd/dls to favor dl content when it is long

* phone number display check fix

* translation cleanup

mc
  • Loading branch information
charlienparker committed Sep 13, 2024
1 parent fc38657 commit b1a27c9
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def income_info_keys
city: 'city',
state: 'state',
zip: 'zip',
employer_phone: 'employer_phone',
employer_phone: 'faa.incomes.employer_phone',
from_self_employment: ['faa.incomes.from_self_employment', {assistance_year: assistance_year}],
unemployment: ['faa.other_incomes.unemployment', {assistance_year: assistance_year}],
alaska_native: 'faa.other_incomes.alaska_native',
Expand Down Expand Up @@ -150,12 +150,12 @@ def personal_info_hash(applicant)
def income_info_hash(applicant, can_edit)
helper = ApplicantDisplayableHelper.new(@cfl_service, applicant.id)

hash = {from_employer: required_value(human_boolean(applicant.has_job_income))}
hash = {from_employer: human_boolean(applicant.has_job_income)}
hash = build_job_incomes_hash(applicant, hash) if helper.displayable?(:incomes_jobs)
hash[:from_self_employment] = required_value(human_boolean(applicant.has_self_employment_income))
hash[:unemployment] = required_value(human_boolean(applicant.has_unemployment_income)) if FinancialAssistanceRegistry.feature_enabled?(:unemployment_income)
hash[:alaska_native] = required_value(human_boolean(applicant.has_american_indian_alaskan_native_income)) if EnrollRegistry.feature_enabled?(:american_indian_alaskan_native_income)
hash[:other_sources] = required_value(human_boolean(applicant.has_other_income))
hash[:from_self_employment] = human_boolean(applicant.has_self_employment_income)
hash[:unemployment] = human_boolean(applicant.has_unemployment_income) if FinancialAssistanceRegistry.feature_enabled?(:unemployment_income)
hash[:alaska_native] = human_boolean(applicant.has_american_indian_alaskan_native_income) if EnrollRegistry.feature_enabled?(:american_indian_alaskan_native_income)
hash[:other_sources] = human_boolean(applicant.has_other_income)

create_section_hash(
title: l10n('faa.evidence_type_income'),
Expand All @@ -169,9 +169,9 @@ def income_info_hash(applicant, can_edit)
def tax_info_hash(applicant, can_edit)
helper = ApplicantDisplayableHelper.new(@cfl_service, applicant.id)

hash = {file_in_year: required_value(human_boolean(applicant.is_required_to_file_taxes))}
hash = {file_in_year: human_boolean(applicant.is_required_to_file_taxes)}
hash[:filing_jointly] = human_boolean(applicant.is_joint_tax_filing) if helper.displayable?(:is_joint_tax_filing)
hash[:dependent] = required_value(human_boolean(applicant.is_claimed_as_tax_dependent))
hash[:dependent] = human_boolean(applicant.is_claimed_as_tax_dependent)
hash[:dependent_by] = @application.find_applicant(applicant.claimed_as_tax_dependent_by.to_s).full_name if helper.displayable?(:claimed_as_tax_dependent_by)

create_section_hash(
Expand All @@ -186,19 +186,20 @@ def tax_info_hash(applicant, can_edit)
def build_job_incomes_hash(applicant, hash)
applicant.incomes.jobs.each do |job|
hash[:employer_name] = job.employer_name
next unless job.employer_address.present?
hash[:employer_address_line_1] = job.employer_address.address_1
hash[:employer_address_line_2] = job.employer_address.address_2 if job.employer_address.address_2.present?
hash[:city] = job.employer_address.city
hash[:state] = job.employer_address.state
hash[:zip] = job.employer_address.zip
if job.employer_address.present?
hash[:employer_address_line_1] = job.employer_address.address_1
hash[:employer_address_line_2] = job.employer_address.address_2 if job.employer_address.address_2.present?
hash[:city] = job.employer_address.city
hash[:state] = job.employer_address.state
hash[:zip] = job.employer_address.zip
end
hash[:employer_phone] = format_phone(income.employer_phone.full_phone_number) if job.employer_phone.present?
end
hash
end

def deductions_info_hash(applicant, can_edit)
row = {l10n('faa.deductions.income_adjustments', subject: l10n('faa.other_ques.this_person'), assistance_year: assistance_year) => required_value(human_boolean(applicant.has_deductions))}
row = {l10n('faa.deductions.income_adjustments', subject: l10n('faa.other_ques.this_person'), assistance_year: assistance_year) => human_boolean(applicant.has_deductions)}
create_section_hash(
title: l10n('faa.review.income_adjustments'),
can_edit: can_edit,
Expand All @@ -223,7 +224,6 @@ def coverage_info_hash(applicant, can_edit)
hash = build_medicaid_cubcare_questions(applicant, hash) if FinancialAssistanceRegistry.feature_enabled?(:has_medicare_cubcare_eligible)
hash = build_chip_questions(applicant, hash) if FinancialAssistanceRegistry[:medicaid_chip_driver_questions].enabled? && applicant.eligible_immigration_status
hash = build_dependent_coverage_questions(applicant, hash) if applicant.age_of_the_applicant < 19 && FinancialAssistanceRegistry.feature_enabled?(:has_dependent_with_coverage)
hash = mark_required_questions(hash)

create_section_hash(
title: l10n('health_coverage'),
Expand Down Expand Up @@ -261,18 +261,6 @@ def build_ihs_questions(applicant, hash)
hash
end

def mark_required_questions(hash)
# all coverage related questions are required
hash.transform_values do |value|
if value.is_a?(Hash)
value[:is_required] = true
value
else
required_value(value)
end
end
end

def other_questions_hash(applicant, can_edit)
helper = ApplicantDisplayableHelper.new(@cfl_service, applicant.id)

Expand Down Expand Up @@ -430,11 +418,6 @@ def initialize(service, id)
end
end

# hash constructor helpers
def required_value(value)
{value: value, is_required: true}
end

def create_section_hash(title:, rows:, can_edit: true, edit_link: nil, map: nil)
{title: title, edit_link: can_edit ? edit_link : nil, rows: map.nil? ? rows : translate_row_keys(rows, map)}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
<dl>
<% subsection[:rows].each do |(term_string, value)| %>
<div class="d-flex justify-content-between align-items-center">
<dt class="col-8 px-0"><%= term_string %></dt>
<dd><%= value.is_a?(Hash) && value[:value].present? ? value[:value] : value %></dd>
<% description = value.is_a?(Hash) && value[:value].present? ? value[:value] : value %>
<dt class="col-<%= description.to_s.length > 12 ? "3" : "8" %> px-0"><%= term_string %></dt>
<dd class="text-right"><%= description %></dd>
</div>
<%# Review Benefits partial for Health Coverage subsection %>
<% if value.is_a?(Hash) && value[:review_benefits_partial].present? %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

<% if FinancialAssistanceRegistry[:medicaid_chip_driver_questions].enabled? && @applicant.eligible_immigration_status %>
<fieldset id="medicaid_chip_ineligible_question" class="pb-4 driver-question">
<legend class="instruction-row weight-n required"><%= l10n("faa.medicaid_chip_ineligible") %> <%= TimeKeeper.date_of_record.year - 5 %>?</legend>
<legend class="instruction-row weight-n required"><%= l10n("faa.medicaid_chip_ineligible", year: TimeKeeper.date_of_record.year - 5) %>?</legend>
<div class="focus d-flex mt-3 instruction-row">
<label class="radio mr-3" for="medicaid_chip_ineligible_true">
<input id="medicaid_chip_ineligible_true" type="radio" value="true" name="medicaid_chip_ineligible" <%='checked' if @applicant.medicaid_chip_ineligible == true %>>
Expand Down Expand Up @@ -190,7 +190,7 @@
<% if @applicant.age_on(TimeKeeper.date_of_record) < 19 && FinancialAssistanceRegistry.feature_enabled?(:has_dependent_with_coverage) %>
<div id="has_dependent_with_coverage_question" class="pb-4 driver-question">
<fieldset>
<legend class="weight-n instruction-row"><%= l10n("faa.has_dependent_with_coverage") %></legend>
<legend class="weight-n required instruction-row"><%= l10n("faa.has_dependent_with_coverage") %></legend>
<div class="focus d-flex mt-3">
<label class="radio mr-3" for="has_dependent_with_coverage_true">
<input id="has_dependent_with_coverage_true" type="radio" value="true" name="has_dependent_with_coverage" <%='checked' if @applicant.has_dependent_with_coverage == true %>>
Expand All @@ -207,7 +207,7 @@
<%= render partial: 'financial_assistance/shared/modal_support_text', locals: {key: "has_dependent_with_coverage"} %>

<fieldset id="denied-job-end-on" class="mt-4">
<legend class="weight-n instruction-row"><%=l10n("faa.dependent_job_end_on")%></legend>
<legend class="weight-n required instruction-row"><%=l10n("faa.dependent_job_end_on")%></legend>
<div class="mr-auto mt-3">
<label class="required" for="dependent_job_end_on"><%==l10n("end_date")%></label>
<%= date_field_tag :dependent_job_end_on, @applicant.dependent_job_end_on&.strftime("%Y-%m-%d"), class: "date-field mt-2", :'data-date-max' => "+0" %>
Expand Down Expand Up @@ -330,7 +330,7 @@
<% if @applicant.eligible_immigration_status %>
<div class="driver-question row row-form-wrapper radio-align no-buffer row-height fa-align-elements">
<div class="col-md-6 labelforcoverage">
<span class="fa-text-color"> <%= l10n("faa.medicaid_chip_ineligible") %> <%= TimeKeeper.date_of_record.year - 5 %>? *</span>
<span class="fa-text-color"> <%= l10n("faa.medicaid_chip_ineligible", year: TimeKeeper.date_of_record.year - 5) %>? *</span>
</div>
<div class="col-md-6 mt11">
<div class="col-md-3 no-padding">
Expand Down Expand Up @@ -448,7 +448,7 @@
<% if @applicant.age_on(TimeKeeper.date_of_record) < 19 && FinancialAssistanceRegistry.feature_enabled?(:has_dependent_with_coverage) %>
<div class="driver-question row row-form-wrapper radio-align no-buffer row-height fa-align-elements">
<div class="col-md-6 labelforcoverage">
<span class="fa-text-color"><%=l10n("faa.has_dependent_with_coverage")%></span>
<span class="fa-text-color"><%=l10n("faa.has_dependent_with_coverage")%>*</span>
</div>
<div class="col-md-6 mt11">
<div class="col-md-3 no-padding">
Expand All @@ -468,7 +468,7 @@

<div class="driver-question row row-form-wrapper radio-align no-buffer row-height fa-align-elements" id='denied-job-end-on'>
<div class="col-md-10 labelforcoverage">
<span class="fa-text-color"><%=l10n("faa.dependent_job_end_on")%></span>
<span class="fa-text-color"><%=l10n("faa.dependent_job_end_on")%>*</span>
<%= text_field_tag("dependent_job_end_on", @applicant.dependent_job_end_on, class: "jq-datepicker", placeholder: 'Select End Date', style: 'margin-left: 50px;') %>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"en.faa.other_ques.this_person" => "this person",
"en.faa.other_ques.ssn_apply" => "Has %{subject} applied for an SSN?",
"en.faa.other_ques.why_no_ssn" => "Why doesn't %{subject} have an SSN?",
"en.faa.other_ques.ssn_reason" => "Reason",
"en.faa.other_ques.ssn_reason" => "No SSN Reason",
"en.faa.other_ques.is_pregnant" => "Is %{subject} pregnant?",
"en.faa.other_ques.pregnancy_due_date" => "Pregnancy due date?",
"en.faa.other_ques.children_expected" => "How many children is %{subject} expecting?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"en.faa.other_ques.this_person" => "this person",
"en.faa.other_ques.ssn_apply" => "Has %{subject} applied for an SSN?",
"en.faa.other_ques.why_no_ssn" => "Why doesn't %{subject} have an SSN?",
"en.faa.other_ques.ssn_reason" => "Reason",
"en.faa.other_ques.ssn_reason" => "No SSN Reason",
"en.faa.other_ques.is_pregnant" => "Is %{subject} pregnant?",
"en.faa.other_ques.pregnancy_due_date" => "Pregnancy due date?",
"en.faa.other_ques.children_expected" => "How many children is %{subject} expecting?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"en.faa.other_ques.this_person" => "this person",
"en.faa.other_ques.ssn_apply" => "Has %{subject} applied for an SSN?",
"en.faa.other_ques.why_no_ssn" => "Why doesn't %{subject} have an SSN?",
"en.faa.other_ques.ssn_reason" => "Reason",
"en.faa.other_ques.ssn_reason" => "No SSN Reason",
"en.faa.other_ques.is_pregnant" => "Is %{subject} pregnant?",
"en.faa.other_ques.pregnancy_due_date" => "Pregnancy due date?",
"en.faa.other_ques.children_expected" => "How many children is %{subject} expecting?",
Expand Down Expand Up @@ -179,10 +179,10 @@
"en.faa.change_eligibility_status" => "Did this person have MaineCare (Medicaid) or Cub Care (Children's Health Insurance Program) that will end soon or that recently ended because of a change in eligibility?",
"en.faa.household_income_changed" => "Has this person's household income or household size changed since they were told their coverage was ending?",
"en.faa.person_medicaid_last_day" => "What is the last day of this person’s MaineCare (Medicaid) or Cub Care (CHIP) coverage?",
"en.faa.medicaid_chip_ineligible" => "Was this person found not eligible for MaineCare (Medicaid) or Cub Care (Children's Health Insurance Program) based on their immigration status since",
"en.faa.medicaid_chip_ineligible" => "Was this person found not eligible for MaineCare (Medicaid) or Cub Care (Children's Health Insurance Program) based on their immigration status since %{year}",
"en.faa.immigration_status_changed" => "Has this person’s immigration status changed since they were not found eligible for MaineCare (Medicaid) or Cub Care (Children’s Health Insurance Program)",
"en.faa.has_dependent_with_coverage" => "Did this person have coverage through a job (for example, a parent’s job) that ended in the last 3 months?*",
"en.faa.dependent_job_end_on" => "What was the last day this person had coverage through the job?*",
"en.faa.has_dependent_with_coverage" => "Did this person have coverage through a job (for example, a parent’s job) that ended in the last 3 months?",
"en.faa.dependent_job_end_on" => "What was the last day this person had coverage through the job?",
"en.faa.health_coverage.title" => "Health Coverage for %{applicant}",
"en.faa.health_coverage.coverage_title" => "Health Coverage %{number}",
"en.faa.health_coverage.desc" => "Tell us about other health coverage options for this person. When you're finished, select 'Continue to Next Step'.",
Expand Down

0 comments on commit b1a27c9

Please sign in to comment.