Browse Source

Schemes - remove action link

CLDC-3740-Replace-you-didnt-answer-with-link
Manny Dinssa 1 week ago
parent
commit
fc837b7cf7
  1. 2
      app/helpers/details_table_helper.rb
  2. 17
      app/helpers/schemes_helper.rb
  3. 2
      app/views/schemes/_scheme_summary_list_row.html.erb
  4. 2
      app/views/schemes/check_answers.html.erb
  5. 2
      app/views/schemes/show.html.erb

2
app/helpers/details_table_helper.rb

@ -37,6 +37,6 @@ private
end end
def scheme_value(attribute, resource) 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") : "<span class=\"app-!-colour-muted\">No answer provided</span>".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") : "<span class=\"app-!-colour-muted\">No answer provided</span>".html_safe
end end
end end

17
app/helpers/schemes_helper.rb

@ -64,10 +64,10 @@ module SchemesHelper
schemes_csv_download_organisation_path(organisation, search:, download_type:) schemes_csv_download_organisation_path(organisation, search:, download_type:)
end end
def change_answer_link(scheme, question_id, user) def scheme_edit_path(scheme, question_id, user = nil)
case question_id case question_id
when "service_name", "sensitive", "scheme_type", "registered_under_care_act", "owning_organisation_id", "arrangement_type" 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" when "primary_client_group"
scheme_primary_client_group_path(scheme, referrer: "check-answers") scheme_primary_client_group_path(scheme, referrer: "check-answers")
when "has_other_client_group" 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? } organisation.owned_schemes.duplicate_sets.any? || organisation.owned_schemes.any? { |scheme| scheme.locations.duplicate_sets.any? }
end 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) def scheme_details_link_message(attribute)
text = lowercase_first_letter(attribute[:name]) text = lowercase_first_letter(attribute[:name])
return "Select #{text}" if %w[primary_client_group secondary_client_group support_type intended_stay].include?(attribute[:id]) return "Select #{text}" if %w[primary_client_group secondary_client_group support_type intended_stay].include?(attribute[:id])

2
app/views/schemes/_scheme_summary_list_row.html.erb

@ -15,7 +15,7 @@
</dd> </dd>
<% end %> <% end %>
<% if can_change_scheme_answer?(attribute[:name], scheme) && attribute[:edit] %> <% if can_change_scheme_answer?(attribute[:name], scheme) && attribute[:edit] && attribute[:value] %>
<dd class="govuk-summary-list__actions"> <dd class="govuk-summary-list__actions">
<a class="govuk-link" href="<%= change_link %>"><%= change_link_text(attribute[:id], @scheme) %></a> <a class="govuk-link" href="<%= change_link %>"><%= change_link_text(attribute[:id], @scheme) %></a>
</dd> </dd>

2
app/views/schemes/check_answers.html.erb

@ -10,7 +10,7 @@
<dl class="govuk-summary-list"> <dl class="govuk-summary-list">
<% @scheme.check_details_attributes.each do |attr| %> <% @scheme.check_details_attributes.each do |attr| %>
<% if attr[:name] != "Status" && (attr[:id] != "secondary_client_group" || @scheme.has_other_client_group == "Yes") %> <% if attr[:name] != "Status" && (attr[:id] != "secondary_client_group" || @scheme.has_other_client_group == "Yes") %>
<%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: change_answer_link(@scheme, attr[:id], current_user) } %> <%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_edit_path(@scheme, attr[:id], current_user) } %>
<% end %> <% end %>
<% end %> <% end %>
</dl> </dl>

2
app/views/schemes/show.html.erb

@ -38,7 +38,7 @@
</dd> </dd>
</div> </div>
<% elsif attr[:id] != "secondary_client_group" || @scheme.has_other_client_group == "Yes" %> <% elsif attr[:id] != "secondary_client_group" || @scheme.has_other_client_group == "Yes" %>
<%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: change_answer_link(@scheme, attr[:id], current_user) } %> <%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_edit_path(@scheme, attr[:id], current_user) } %>
<% end %> <% end %>
<% end %> <% end %>

Loading…
Cancel
Save