Skip to content

Commit

Permalink
Add link to parental consent form
Browse files Browse the repository at this point in the history
This adds a link to allow users to see the parental consent form for a
particular session.
  • Loading branch information
thomasleese committed Oct 15, 2024
1 parent fcdde64 commit da1175a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
22 changes: 22 additions & 0 deletions app/components/app_session_summary_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ def call
row.with_key { "Consent period" }
row.with_value { consent_period }
end
if consent_link
summary_list.with_row do |row|
row.with_key { "Consent link" }
row.with_value do
govuk_link_to(
"View parental consent form (opens in a new tab)",
consent_link,
new_tab: true
)
end
end
end
summary_list.with_row do |row|
row.with_key { "Children" }
row.with_value { children }
Expand Down Expand Up @@ -60,6 +72,16 @@ def consent_period
helpers.session_consent_period(@session)
end

def consent_link
if @session.open_for_consent?
# TODO: handle multiple programmes
start_parent_interface_consent_forms_path(
@session,
@session.programmes.first
)
end
end

def children
"#{I18n.t("children", count: @session.patients.count)} in this session"
end
Expand Down
11 changes: 11 additions & 0 deletions spec/components/app_session_summary_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
it { should have_content("Consent period") }
it { should have_content("Closed 31 December") }

it { should_not have_content("Consent link") }

it { should have_content("Children") }
it { should have_content("No children") }

context "when consent is open" do
let(:session) do
create(:session, location:, date: 1.week.from_now.to_date, programme:)
end

it { should have_content("Consent link") }
it { should have_link("View parental consent form (opens in a new tab)") }
end
end

0 comments on commit da1175a

Please sign in to comment.