otwarchive-symphonyarchive/app/views/kudo_mailer/batch_kudo_notification.html.erb
2026-03-11 22:22:11 +00:00

26 lines
1 KiB
Text

<% content_for :message do %>
<% @commentables.each_with_index do |commentable, index| %>
<%
commentable_link = style_creation_link(commentable.commentable_name, polymorphic_url(commentable))
givers_hash = @user_kudos["#{commentable.class.name}_#{commentable.id}"]
names = givers_hash["names"]
guest_count = givers_hash["guest_count"].to_i
kudo_count = names.size + guest_count
givers = names.map { |name| style_link(name, user_url(name)) }
givers << t(".guest", count: guest_count) unless guest_count.zero?
givers_list = to_sentence(givers.map { |k| style_bold(k) })
%>
<% if kudo_count == 1 && guest_count == 1 %>
<%= t(".single_guest.html", giver: style_bold(t(".single_guest.giver")), commentable_link: commentable_link) %>
<% else %>
<%= t(".left_kudos.html", givers_list: givers_list, commentable_link: commentable_link, count: kudo_count) %>
<% end %>
<% if (index < @commentables.length - 1) %>
<%= styled_divider %>
<% end %>
<% end %>
<% end %>