<% content_for :message do %>
<%= t(".assignment.text", collection_title: @collection.title, collection_url: collection_url(@collection)) %>

<%= metadata_label(t(".recipient")) %><%= @request.nil? ? t(".recipient_missing") : text_pseud(@request.pseud) %>

<%= t(".prompts") %>
<% @request.requests.each_with_index do |prompt, index| %>
<% tag_groups = prompt.tag_groups %>
<% def tag_list(tags) %>
<%  return nil if !tags || tags.empty? %>
<%  tags.map { |tag| tag.name }.to_sentence.html_safe %>
<% end %>
<% fandoms = prompt.any_fandom ? t(".any") : tag_list(tag_groups["Fandom"]) %>
<% chars = prompt.any_character ? t(".any") : tag_list(tag_groups["Character"]) %>
<% ships = prompt.any_relationship ? t(".any") : tag_list(tag_groups["Relationship"]) %>
<% ratings = prompt.any_rating ? t(".any") : (tag_groups["Rating"] ? get_title_string(tag_groups["Rating"]) : nil) %>
<% warnings = prompt.any_archive_warning ? t(".any") : (tag_groups["ArchiveWarning"] ? get_title_string(tag_groups["ArchiveWarning"]) : nil) %>
<% categories = prompt.any_category ? t(".any") : (tag_groups["Category"] ? get_title_string(tag_groups["Category"]) : nil) %>
<% atags = prompt.any_freeform ? t(".any") : tag_list(tag_groups["Freeform"]) %>
<% otags = prompt.optional_tag_set ? tag_list(prompt.optional_tag_set.tags) : nil %>
<%= text_divider %>

<%= index + 1 %>. <%= prompt.title %>

<% if fandoms %>
<%= metadata_label(t("activerecord.models.fandom", count: prompt.any_fandom ? 1 : tag_groups["Fandom"].count)) %><%= fandoms %>
<% end %>
<% if chars %>
<%= metadata_label(t("activerecord.models.character", count: prompt.any_character ? 1 : tag_groups["Character"].count)) %><%= chars %>
<% end %>
<% if ships %>
<%= metadata_label(t("activerecord.models.relationship", count: prompt.any_relationship ? 1 : tag_groups["Relationship"].count)) %><%= ships %>
<% end %>
<% if ratings %>
<%= metadata_label(t("activerecord.models.rating", count: prompt.any_rating ? 1 : tag_groups["Rating"].count)) %><%= ratings %>
<% end %>
<% if warnings %>
<%= metadata_label(t("activerecord.models.archive_warning", count: prompt.any_archive_warning ? 1 : tag_groups["ArchiveWarning"].count)) %><%= warnings %>
<% end %>
<% if categories %>
<%= metadata_label(t("activerecord.models.category", count: prompt.any_category ? 1 : tag_groups["Category"].count)) %><%= categories %>
<% end %>
<% if atags %>
<%= metadata_label(t("activerecord.models.freeform", count: prompt.any_freeform ? 1 : tag_groups["Freeform"].count)) %><%= atags %>
<% end %>
<% if otags %>
<%= metadata_label(t(".optional_tags")) %><%= otags %>
<% end %>
<% if prompt.url && !prompt.url.blank? %>
<%= metadata_label(t(".prompt_url")) %><%= prompt.url %>
<% end %>
<% if prompt.description && !prompt.description.blank? %>
<%= metadata_label(t(".description")) %>
    <%= to_plain_text(prompt.description) %>
<% end %>

<% end %><%= text_divider %>

<%= metadata_label(t(".due")) %><%= to_plain_text(time_in_zone(@collection.challenge.assignments_due_at, (@collection.challenge.time_zone || Time.zone.name), @assigned_user)).gsub(/\n\s*/, "") %>.

<%= t(".look_up.text", your_assignments_url: user_assignments_url(@assigned_user)) %>
<% if @collection && !@collection.assignment_notification.blank? %>


<%= @collection.assignment_notification %><% end %><% end %>
<% content_for :footer_note do %>
<%= t(".footer.text", title: @collection.title, url: collection_url(@collection), challenge_profile_url: collection_profile_url(@collection)) -%>
<% end %>
<% content_for :sent_at do %>
<%= l(@assignment.sent_at) -%>
<% end %>
