Skip to content

Commit

Permalink
refactor and render display_choices method (#3175)
Browse files Browse the repository at this point in the history
Refactor how displayable batch connect fields are displayed
on the cards to a partial instead of programmatically.
  • Loading branch information
akuppa9 authored Nov 8, 2023
1 parent 65f0ff3 commit ea4e112
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 1 addition & 8 deletions apps/dashboard/app/helpers/batch_connect/sessions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<% user_context = session.user_context %>
<% session.app.attributes.select(&:display?).each do |attribute| %>
<p>
<strong><%= attribute.label %>:</strong> <%= user_context.fetch(attribute.id, '') %>
</p>
<% end %>

0 comments on commit ea4e112

Please sign in to comment.