From fc837b7cf78802ac7484e4a32c78da094c8ab4a7 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:50:59 +0000 Subject: [PATCH] Schemes - remove action link --- app/helpers/details_table_helper.rb | 2 +- app/helpers/schemes_helper.rb | 17 ++--------------- .../schemes/_scheme_summary_list_row.html.erb | 2 +- app/views/schemes/check_answers.html.erb | 2 +- app/views/schemes/show.html.erb | 2 +- 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/app/helpers/details_table_helper.rb b/app/helpers/details_table_helper.rb index f58720591..343673235 100644 --- a/app/helpers/details_table_helper.rb +++ b/app/helpers/details_table_helper.rb @@ -37,6 +37,6 @@ private end def scheme_value(attribute, resource) - can_change_scheme_answer?(attribute[:name], resource) ? govuk_link_to(scheme_details_link_message(attribute), scheme_edit_path(resource, attribute), class: "govuk-link govuk-link--no-visited-state") : "No answer provided".html_safe + can_change_scheme_answer?(attribute[:name], resource) ? govuk_link_to(scheme_details_link_message(attribute), scheme_edit_path(resource, attribute[:id]), class: "govuk-link govuk-link--no-visited-state") : "No answer provided".html_safe end end diff --git a/app/helpers/schemes_helper.rb b/app/helpers/schemes_helper.rb index 6d638bc61..6d6c04367 100644 --- a/app/helpers/schemes_helper.rb +++ b/app/helpers/schemes_helper.rb @@ -64,10 +64,10 @@ module SchemesHelper schemes_csv_download_organisation_path(organisation, search:, download_type:) end - def change_answer_link(scheme, question_id, user) + def scheme_edit_path(scheme, question_id, user = nil) case question_id when "service_name", "sensitive", "scheme_type", "registered_under_care_act", "owning_organisation_id", "arrangement_type" - user.support? || !scheme.confirmed? ? scheme_details_path(scheme, referrer: "check-answers") : scheme_edit_name_path(scheme) + user&.support? || !scheme.confirmed? ? scheme_details_path(scheme, referrer: "check-answers") : scheme_edit_name_path(scheme) when "primary_client_group" scheme_primary_client_group_path(scheme, referrer: "check-answers") when "has_other_client_group" @@ -107,19 +107,6 @@ module SchemesHelper organisation.owned_schemes.duplicate_sets.any? || organisation.owned_schemes.any? { |scheme| scheme.locations.duplicate_sets.any? } end - def scheme_edit_path(scheme, attribute) - case attribute[:id] - when "primary_client_group" - scheme_primary_client_group_path(scheme, referrer: "check-answers") - when "has_other_client_group" - scheme_confirm_secondary_client_group_path(scheme, referrer: "check-answers") - when "secondary_client_group" - scheme_secondary_client_group_path(scheme, referrer: "check-answers") - when "support_type", "intended_stay" - scheme_support_path(scheme, referrer: "check-answers") - end - end - def scheme_details_link_message(attribute) text = lowercase_first_letter(attribute[:name]) return "Select #{text}" if %w[primary_client_group secondary_client_group support_type intended_stay].include?(attribute[:id]) diff --git a/app/views/schemes/_scheme_summary_list_row.html.erb b/app/views/schemes/_scheme_summary_list_row.html.erb index 822c70c08..8204d856e 100644 --- a/app/views/schemes/_scheme_summary_list_row.html.erb +++ b/app/views/schemes/_scheme_summary_list_row.html.erb @@ -15,7 +15,7 @@ <% end %> - <% if can_change_scheme_answer?(attribute[:name], scheme) && attribute[:edit] %> + <% if can_change_scheme_answer?(attribute[:name], scheme) && attribute[:edit] && attribute[:value] %>