davearonson/pull-request-roulette

View on GitHub
app/views/pull_requests/_pull_request.html.erb

Summary

Maintainability
Test Coverage
<%# TODO: MOVE ALL THIS LOGIC INTO A PRESENTER! %>

<tr id="pr-<%= pull_request.id %>">
  <% url = pull_request.to_url %>
  <td class="pr-url">
    <%= link_to(url.gsub("https://github.com/", ""),
                url, target: '_new') %>
  </td>
  <td class="pr-author">
    <%= link_to("#{pull_request.author}",
                  github_user_url(pull_request.author),
                  target: '_new') %>
  </td>
  <td class="pr-submitter">
    <%= link_to("#{pull_request.submitter}",
                  github_user_url(pull_request.submitter),
                  target: '_new') %>
    <%# TODO: if that's the current user, let him close review %>
  </td>
  <td class="pr-reviewer">
    <% reviewer = pull_request.reviewer %>
    <% if reviewer %>
      <%= reviewer %>
      <% if pull_request.can_have_review_closed_by? controller.current_user_handle %>
        <%= link_to('Close Review', pull_request_close_review_path(pull_request),
                    method: :post, class: "close-review-button") %>
      <% end %>
    <% else %>
      None!
      <% if signed_in? %>
        <%= link_to('Take', pull_request_take_path(pull_request),
                    method: :post, class: "take-button",
                    id: "take-#{pull_request.id}") %>
      <% else %>
        Sign in to volunteer.
      <% end %>
    <% end %>
  </td>
</tr>