Skip to content

Commit

Permalink
Font formatting and copy updates
Browse files Browse the repository at this point in the history
  • Loading branch information
opticbob committed Sep 6, 2024
1 parent c35a487 commit 3e430fd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,15 @@ def next_steps_part1(pdf)
# TODO: - Add a method that takes a text string then adds it to the pdf,
# moves down 10, and sets the font size to 12
add_text_with_spacing(pdf,
'Fill out your form to appoint a VA accredited representative or VSO', size: 20,
style: :bold)
'Request help from a VA accredited representative or VSO', size: 20,
style: :bold)
add_text_with_spacing(pdf, 'VA Form 21-22a')
add_text_with_spacing(pdf, 'Your Next Steps', size: 16, style: :bold)
str = <<~HEREDOC.squish
Both you and the accredited representative will need to sign your form.
You can bring your form to them in person or mail it to them.
HEREDOC
pdf.text(str)
pdf.move_down(30)
add_text_with_spacing(pdf, str, move_down: 30, font: 'soursesanspro')
end

def next_steps_part2(pdf)
Expand All @@ -76,34 +75,25 @@ def next_steps_part2(pdf)
After your form is signed, you or the accredited representative
can submit it online, by mail, or in person.
HEREDOC
pdf.text(str)
pdf.move_down(10)
add_text_with_spacing(pdf, str, font: 'soursesanspro')
add_text_with_spacing(pdf, 'After you submit your printed form', size: 16, style: :bold)
pdf.font_size(12)
str = <<~HEREDOC.squish
We'll confirm that the accredited representative is available to help you.
Then we'll update your VA.gov profile with their information.
HEREDOC
pdf.text(str)
pdf.move_down(10)
end

def next_steps_part3(pdf)
str = <<~HEREDOC.squish
We usually process your form within 1 week.
You can contact the accredited representative any time to ask when they can start helping you.
We usually process your form within 1 week. You can contact the accredited representative any time.
HEREDOC
pdf.text(str)
pdf.move_down(10)
add_text_with_spacing(pdf, str, font: 'soursesanspro')
add_text_with_spacing(pdf, 'Need help?', size: 14, style: :bold)
pdf.font_size(12)
pdf.text("You can call us at 800-698-2411, ext. 0 (TTY: 711). We're here 24/7.")
pdf.move_down(10)
add_text_with_spacing(pdf, "You can call us at 800-698-2411, ext. 0 (TTY: 711). We're here 24/7.",
font: 'soursesanspro')
end

private

def add_text_with_spacing(pdf, text, size: 12, move_down: 10, style: :normal, font: 'bitter')

Check failure on line 94 in modules/representation_management/lib/representation_management/v0/pdf_constructor/base.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Metrics/ParameterLists: Avoid parameter lists longer than 5 parameters. [6/5]
p "add_text_with_spacing: #{text}", "size: #{size}", "move_down: #{move_down}", "style: #{style}",
"font: #{font}", '*' * 50
pdf.font(font, style:) do
pdf.font_size(size)
pdf.text(text)
Expand All @@ -112,6 +102,18 @@ def add_text_with_spacing(pdf, text, size: 12, move_down: 10, style: :normal, fo
pdf.font_size(12) # Reset to default size
end

def format_phone_number(phone_number)
p "format_phone_number: #{phone_number}"
return '' if phone_number.blank?

p "format_phone_number: #{phone_number} not blank"
phone_number = phone_number.gsub(/\D/, '')
return phone_number if phone_number.length < 10

p "format_phone_number: #{phone_number} length >= 10"
"#{phone_number[0..2]}-#{phone_number[3..5]}-#{phone_number[6..9]}"
end

#
# Fill in pdf form fields based on data provided, then combine all
# the pages into a final pdf. We create an inner tempfile to fill
Expand All @@ -134,7 +136,6 @@ def generate_next_steps_page(data)
next_steps = Prawn::Document.new
next_steps.font_families.update(
'bitter' => {
# modules/health_quest/lib/fonts/bitter-regular.ttf
normal: Rails.root.join('modules', 'representation_management', 'lib', 'fonts', 'bitter-regular.ttf'),
bold: Rails.root.join('modules', 'representation_management', 'lib', 'fonts', 'bitter-bold.ttf')
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ def next_steps_contact(pdf, data)
#{data.representative_middle_initial}
#{data.representative_last_name}
HEREDOC
pdf.font('bitter', style: :bold) do
pdf.text(rep_name)
add_text_with_spacing(pdf, rep_name, style: :bold, move_down: 8)
pdf.font('soursesanspro') do
pdf.text(data.representative_address_line1)
pdf.text(data.representative_address_line2)
city_state_zip = <<~HEREDOC.squish
#{data.representative_city},
#{data.representative_state_code}
#{data.representative_zip_code}
HEREDOC
pdf.text(city_state_zip)
pdf.move_down(5)
pdf.text(format_phone_number(data.representative_phone))
pdf.text(data.representative_email_address)
end
pdf.text(data.representative_address_line1)
pdf.text(data.representative_address_line2)
city_state_zip = <<~HEREDOC.squish
#{data.representative_city},
#{data.representative_state_code}
#{data.representative_zip_code}
HEREDOC
pdf.text(city_state_zip)
pdf.move_down(5)
pdf.text(data.representative_phone)
pdf.text(data.representative_email_address)
end

def template_path
Expand Down

0 comments on commit 3e430fd

Please sign in to comment.