From b0c0d302958482729cfaa48a029ab9523d087f7c Mon Sep 17 00:00:00 2001 From: Iain McNulty Date: Mon, 23 Oct 2023 13:18:48 +0100 Subject: [PATCH] Add anchor to ActivityLog ApplicationForm link --- .../activity_log/application_form.rb | 15 +++++++++++++++ .../activity_log_event_component.rb | 2 ++ 2 files changed, 17 insertions(+) diff --git a/app/components/provider_interface/activity_log/application_form.rb b/app/components/provider_interface/activity_log/application_form.rb index c3809428db3..d91b00cdd4d 100644 --- a/app/components/provider_interface/activity_log/application_form.rb +++ b/app/components/provider_interface/activity_log/application_form.rb @@ -10,6 +10,21 @@ def initialize(event:) def event_description "#{section.humanize} edited" end + + def link + application_link("#{section.tr('_', '-')}-section") + end + + def application_link(anchor = nil) + { + url: routes.provider_interface_application_choice_path(event.application_choice, anchor:), + text: 'View application', + } + end + + def routes + @_routes ||= Rails.application.routes.url_helpers + end end end end diff --git a/app/components/provider_interface/activity_log_event_component.rb b/app/components/provider_interface/activity_log_event_component.rb index 5be706f33a2..2471ea8b718 100644 --- a/app/components/provider_interface/activity_log_event_component.rb +++ b/app/components/provider_interface/activity_log_event_component.rb @@ -56,6 +56,8 @@ def link feedback_link elsif event.audit.auditable.is_a?(Interview) interview_link(event.audit) + elsif event.audit.auditable.is_a?(ApplicationForm) + auditable_adapter(@event.audit.auditable_type).link else application_link end