<!-- expects local "assignment" -->
<%= fields_for "challenge_assignments[]", assignment do |assignment_form| %>
  <% request_signup = assignment.request_signup %>
  <% offer_signup = assignment.offer_signup %>
  <tr>
    <th scope="row">
      <%= link_to assignment.id, collection_assignment_path(@collection, assignment) %>
    </th>
    <td id="request_signup_for_<%= assignment.id %>">
      <% if offer_signup %>
        <% # offer an autocomplete of potential matches %>
        <%= assignment_form.text_field :request_signup_pseud, autocomplete_options("potential_requests?signup_id=#{offer_signup.id}", 
          data: { autocomplete_min_chars: 0, autocomplete_token_limit: 1 }, size: ArchiveConfig.POTENTIAL_MATCHES_MAX) %>
      <% else %>
        <%= request_signup.pseud.byline %>
      <% end %>
    </td>
    
    <td id="offer_signup_for_<%= assignment.id %>">
      <% if request_signup %>
        <% # offer an autocomplete of potential matches %>
        <%= assignment_form.text_field :offer_signup_pseud, autocomplete_options("potential_offers?signup_id=#{request_signup.id}", 
          data: { autocomplete_min_chars: 0, autocomplete_token_limit: 1 }, size: ArchiveConfig.POTENTIAL_MATCHES_MAX) %>
      <% else %>
        <%= offer_signup.pseud.byline %>
      <% end %>
    </td>
    
    <% unless params[:no_recipient] %>
      <td><!--BACK END this td should probably be titled, but what with?-->
        <%= assignment_form.text_field :pinch_hitter_byline, autocomplete_options("pseud", data: { autocomplete_token_limit: 1 }, size: 20) %>
      </td>
    <% end %>
  </tr>
  
<% end %> <!-- end form -->
