<% if @collection && @collection.user_is_maintainer?(current_user) %>
<% # we're listing assignments for a mod by the assigned writer %>
<%= challenge_assignment_byline(assignment) %> <%= challenge_assignment_email(assignment) %>
<% else %>
<% # we're listing assignments for a user by the recipient %>
<%= link_to assignment.collection.title, collection_assignment_path(assignment.collection, assignment) %>
<%= ts("for") %> <%= link_to assignment.request_byline, collection_assignment_path(assignment.collection, assignment) %>
<% end %>
<% # link to the work %>
<% if assignment.creation %>
<%= link_to (assignment.creation.try(:title) || assignment.creation.class.name), assignment.creation, :class => "work" %>
<% end %>
<% if @collection && @collection.user_is_maintainer?(current_user) %>
<% # for a mod: list recipient (and check in case there are some people without recipients) %>
<% if assignment.request_signup %>
<%= ts("for") %> <%= link_to assignment.request_byline, collection_assignment_path(@collection, assignment) %>
<% else %>
<%= ts("No Recipient") %>
<% end %>
<% end %>
<%= ts("Status:") %>
<% # status can be: unposted (no creation), unapproved (creation but it hasn't been approved), complete %>
<% if !assignment.posted? %>
<%= ts("Unposted") %>
<% elsif !assignment.fulfilled? %>
<%= ts("Unapproved") %>
<% else %>
<%= ts("Complete!") %>
<% end %>
<% if assignment.creation %>
<%= ts("Posted:") %>
<%= assignment.creation.published_at %>
<% if assignment.creation.respond_to?(:word_count) %>
<%= link_to ts("Default"), default_collection_assignment_path(assignment.collection, assignment),
data: {confirm: ts("Are you sure? This will mark you as having defaulted and notify the collection maintainer! It cannot be undone.")} %>
<% elsif @collection && @collection.user_is_maintainer?(current_user) %>
<%= fields_for "challenge_assignments[]", assignment do |assignment_form| %>
<% end %>
<% end %>