<table class="striped" width="100%">
  <thead>
    <tr>
      <th>Creator</th>
      <th>Approver</th>
      <th>Forum</th>
      <th>Script</th>
      <th>Status</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% bulk_update_requests.each do |request| %>
      <tr id="request-<%= request.id %>">
        <td><%= link_to_user(request.user) %></td>
        <td><% if request.approver %><%= link_to_user(request.approver) %><% end %></td>
        <td>
          <% if request.forum_topic_id %>
            <%= link_to(request.forum_topic_id, forum_topic_path(request.forum_topic_id)) %>
          <% end %>
        </td>
        <td><%= script_with_line_breaks(request.script) %></td>
        <td id="request-status-for-<%= request.id %>"><%= request.status %></td>
        <td>
          <% if CurrentUser.is_admin? && request.status == "pending" %>
            <%= link_to "Approve", approve_bulk_update_request_path(request), :remote => true, :method => :post %> |
          <% end %>
          <% if request.editable?(CurrentUser.user) %>
            <%= link_to "Reject", bulk_update_request_path(request), :method => :delete, :remote => true, :data => {:confirm => "Are you sure you want to reject this bulk update request?"} %> |
            <%= link_to "Edit", edit_bulk_update_request_path(request) %>
          <% end %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>