<%#
# To change this template, choose Tools | Templates
# and open the template in the editor.
%>

<%
unless User.current.allowed_to?({:controller => 'code_review', :action => 'show'}, project)
  return 
end

%>

<% if issue.code_review %>
<%
review = issue.code_review
%>
  <tr>
    <td><b><%= l(:code_review) %>:</b></td>
    <td colspan="3">
      <%
      label = URI.decode("#{review.repository_identifier + ':' if review.repository_identifier}#{review.path}#{'@' + review.revision if review.revision}:line #{review.line}")
      -%>
      <%= link_to(label,
        :controller => 'code_review', :action => 'show', :id => project, :review_id => review.id, :repository_id => review.repository_identifier) %>
    </td>
  </tr>
<% end %>
<% if issue.code_review_assignment %>
  <%    
  assignment = issue.code_review_assignment
  repository_id = assignment.repository_identifier
%>
  <tr>
    <td><b><%= l(:review_assigned_for) %>:</b></td>
    <td colspan="3">
      <% if assignment.path %>
        <%
        label = URI.decode("#{repository_id + ':' if repository_id}#{assignment.path}#{'@' + assignment.revision if assignment.revision}")
        -%>
        <%= link_to(label,
          :controller => 'code_review', :action => 'show', :id => project, :assignment_id => assignment.id, :repository_id => repository_id) %>
      <% elsif assignment.revision %>
        <%
        repo = project unless repository_id
        repo ||= assignment.repository
      %>
        <%= l(:label_revision) + " "%>
      <%=  link_to_revision(assignment.revision, repo) %>
      <% elsif assignment.respond_to?("attachment") && assignment.attachment %>
        <%= link_to(assignment.attachment.filename.to_s, :controller => 'attachments', :action => 'show', :id => assignment.attachment.id) %>
      <% end %>
    </td>
  </tr>

<% end %>

