From ea4e11231442bc0220fbef9a2eaa52e46eb3d7e8 Mon Sep 17 00:00:00 2001 From: akuppa9 <140134379+akuppa9@users.noreply.github.com> Date: Wed, 8 Nov 2023 12:53:38 -0500 Subject: [PATCH] refactor and render display_choices method (#3175) Refactor how displayable batch connect fields are displayed on the cards to a partial instead of programmatically. --- .../app/helpers/batch_connect/sessions_helper.rb | 9 +-------- .../sessions/card/_display_choices.html.erb | 6 ++++++ 2 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 apps/dashboard/app/views/batch_connect/sessions/card/_display_choices.html.erb diff --git a/apps/dashboard/app/helpers/batch_connect/sessions_helper.rb b/apps/dashboard/app/helpers/batch_connect/sessions_helper.rb index f614f83d1c..5fa8f035c3 100644 --- a/apps/dashboard/app/helpers/batch_connect/sessions_helper.rb +++ b/apps/dashboard/app/helpers/batch_connect/sessions_helper.rb @@ -129,14 +129,7 @@ def support_ticket(session) end def display_choices(session) - user_context = session.user_context - session.app.attributes.select(&:display?).map do |attribute| - content_tag(:p) do - concat content_tag(:strong, "#{attribute.label}:") - concat " " - concat user_context.fetch(attribute.id, '') - end - end.join.html_safe + render(partial: 'batch_connect/sessions/card/display_choices', locals: { session: session }) end def status(session) diff --git a/apps/dashboard/app/views/batch_connect/sessions/card/_display_choices.html.erb b/apps/dashboard/app/views/batch_connect/sessions/card/_display_choices.html.erb new file mode 100644 index 0000000000..acda236f77 --- /dev/null +++ b/apps/dashboard/app/views/batch_connect/sessions/card/_display_choices.html.erb @@ -0,0 +1,6 @@ +<% user_context = session.user_context %> +<% session.app.attributes.select(&:display?).each do |attribute| %> +

+ <%= attribute.label %>: <%= user_context.fetch(attribute.id, '') %> +

+<% end %>