From 6856ca2cae03e3d916a752c1522d92cd69aa4787 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:22:11 +0000 Subject: [PATCH] One version of details_html --- app/helpers/details_table_helper.rb | 39 ----------------------------- 1 file changed, 39 deletions(-) diff --git a/app/helpers/details_table_helper.rb b/app/helpers/details_table_helper.rb index ed29cbea3..41e569c5d 100644 --- a/app/helpers/details_table_helper.rb +++ b/app/helpers/details_table_helper.rb @@ -22,43 +22,4 @@ module DetailsTableHelper simple_format(value.to_s, { class: "govuk-body" }, wrapper_tag: "p") end end - - def location_details_html(attribute, location) - if attribute[:format] == :bullet && attribute[:value].length > 1 - list = attribute[:value].map { |value| "
  • #{value}
  • " }.join - simple_format(list, { class: "govuk-list govuk-list--bullet" }, wrapper_tag: "ul") - else - return simple_format(attribute[:value].first.to_s, { class: "govuk-body" }, wrapper_tag: "p") if attribute[:value].is_a?(Array) && attribute[:value].any? - - value = attribute[:value].presence || (LocationPolicy.new(current_user, @location).update? ? govuk_link_to(location_details_link_message(attribute), location_edit_path(location, attribute[:attribute]), class: "govuk-link govuk-link--no-visited-state") : "No answer provided".html_safe) - - simple_format(value.to_s, { class: "govuk-body" }, wrapper_tag: "p") - end - end - - def organisation_details_html(attribute, organisation) - if attribute[:format] == :bullet && attribute[:value].length > 1 - list = attribute[:value].map { |value| "
  • #{value}
  • " }.join - simple_format(list, { class: "govuk-list govuk-list--bullet" }, wrapper_tag: "ul") - else - return simple_format(attribute[:value].first.to_s, { class: "govuk-body" }, wrapper_tag: "p") if attribute[:value].is_a?(Array) && attribute[:value].any? - - value = attribute[:value].presence || (can_edit_org?(current_user) && attribute[:editable] ? govuk_link_to(organisation_details_link_message(attribute), edit_organisation_path(organisation), class: "govuk-link govuk-link--no-visited-state") : "No answer provided".html_safe) - - simple_format(value.to_s, { class: "govuk-body" }, wrapper_tag: "p") - end - end - - def scheme_details_html(attribute, scheme) - if attribute[:format] == :bullet && attribute[:value].length > 1 - list = attribute[:value].map { |value| "
  • #{value}
  • " }.join - simple_format(list, { class: "govuk-list govuk-list--bullet" }, wrapper_tag: "ul") - else - return simple_format(attribute[:value].first.to_s, { class: "govuk-body" }, wrapper_tag: "p") if attribute[:value].is_a?(Array) && attribute[:value].any? - - value = attribute[:value].presence || (can_change_scheme_answer?(attribute[:name], scheme) ? govuk_link_to(scheme_details_link_message(attribute), scheme_edit_path(scheme, attribute), class: "govuk-link govuk-link--no-visited-state") : "No answer provided".html_safe) - - simple_format(value.to_s, { class: "govuk-body" }, wrapper_tag: "p") - end - end end