Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update how form answer PDFs are rendered for supporters question #719

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,41 @@ def render_supporters
end

def render_supporters_list(entries)
entries.each do |entry|
ops = {
full_name: "#{entry.first_name} #{entry.last_name}",
relationship_to_nominee: entry.relationship_to_nominee
}

render_supporter(entry, ops)
entries.each_with_index do |entry, index|
entry_index = index == 0 ? "first" : "second"
ops = [
{ title: "name_of_the_person_who_wrote_the_#{entry_index}_letter_of_support".to_sym, value: ''},
{ sub_field: "first_name".to_sym, value: entry.first_name },
{ sub_field: "last_name".to_sym, value: entry.last_name },
{ title: "relationship_to_nominee".to_sym, value: entry.relationship_to_nominee, hint: "For example, a beneficiary of the group, local resident or member of a partner charity." },
]

render_supporter(entry, ops, entry_index)
end
end

def render_supporter(entry, ops)
def render_supporter(entry, ops, entry_index)
form_pdf.move_down 5.mm

ops.each do |option_title, option_value|
form_pdf.text "#{option_title.to_s.split("_").join(" ").capitalize}: ", style: :bold
form_pdf.text option_value
ops.each do |op|
form_pdf.text "#{format_label(op[:title])}: ", style: :bold if op[:title]
form_pdf.text "#{format_label(op[:sub_field])}: " if op[:sub_field]
form_pdf.text(op[:hint], style: :italic) if op[:hint]
form_pdf.text op[:value]
form_pdf.move_down 2.5.mm
end

if entry.is_a?(SupportLetter)
render_support_letter(entry)
render_support_letter(entry, entry_index)
end
end

def render_support_letter(entry)
form_pdf.text "Letter of Support: ", style: :bold
def format_label(text)
text.to_s.split('_').join(' ').capitalize
end

def render_support_letter(entry, entry_index)
form_pdf.text "Upload the #{entry_index} letter of support: ", style: :bold

if entry.support_letter_attachment.present?
form_pdf.base_link_sceleton(
Expand Down
2 changes: 0 additions & 2 deletions app/pdf_generators/qae_pdf_forms/general/question_pointer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,7 @@ def question_answer(question)
when QaeFormBuilder::ByYearsQuestion, QaeFormBuilder::OneOptionByYearsQuestion
render_years_table
when QaeFormBuilder::SupportersQuestion
form_pdf.indent 7.mm do
render_supporters
end
when QaeFormBuilder::TextareaQuestion
title = q_visible? && humanized_answer.present? ? humanized_answer : ""

Expand Down
4 changes: 2 additions & 2 deletions forms/award_years/v2025/qavs/qavs_step3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def qavs_step3
pdf_context_with_header_blocks [
[:normal, %(Letters of support are an essential part of your nomination, as they help to clarify and explain the impact of the nominated group's work in the local community. You will need to provide 2 letters of support alongside your nomination.)],
[:normal, %(For more information on what letters can cover, please see the <link href="https://kavs.dcms.gov.uk/make-a-nomination/letters-of-support/" target="_blank">Letters of Support page</link> on our website.)],
[:bold, %(Key criteria:

[:bold, %(Key criteria:)],
[:normal, %(
1. Letters must be written by individuals who are familiar with the group's work, for example: a beneficiary, local resident or member of a partner charity.
2. Letters must not be written by a volunteer, employee, trustee, or anyone involved in the running of the group.
3. Letters written by the nominator will be ineligible.
Expand Down
Loading