identifier_abbreviated=Id
inactive=Inactive
info=Info
+issue=Issue
+issues=Issues
inheritance=Inheritance
key=Key
language=Language
SECTION=Navigation::SECTION_RESOURCE
+ helper SourceHelper, UsersHelper
+
# Used for the permalink, e.g. http://localhost:9000/issue/view/1
def view
issue_result = find_issues({'issueKeys' => params[:id]})
if issue_result.issues.length == 1
- @issue = issue_result.issues[0]
- @rule = issue_result.rule(@issue)
- @resource = Project.by_key(@issue.component_key)
- render 'issue/_view', :locals => {:issue => @issue, :rule => @rule, :resource => @resource}
+ issue = issue_result.issues[0]
+ rule = issue_result.rule(issue)
+
+ resource = Project.by_key(issue.component_key)
+ project = resource.root_project
+
+ # Only used for breadcrumb
+ @resource = project
+
+ render 'issue/_view', :locals => {:issue => issue, :rule => rule, :resource => resource, :project => project}
else
render :text => "<b>Cannot access this issue</b> : not found."
end
</td>
<td class="val" colspan="3">
<%= qualifier_icon(resource) -%>
- <% if resource.root_project.id != resource.id %>
- <%= resource.root_project.long_name -%> <%= image_tag 'sep12.png' -%>
+ <% if project.id != resource.id %>
+ <%= project.long_name -%> <%= image_tag 'sep12.png' -%>
<% end %>
<% if resource.last_snapshot %>
<%= link_to_resource(resource, resource.long_name, {:tab => :violations, :rule => issue.resolution == "FALSE-POSITIVE" ? "false_positive_issues" : ""}) %>
</tr>
</table>
+ <% if issue.line && has_role?(:codeviewer, project) %>
+ <div class="marginbottom10">
+ <%= snapshot_html_source(resource.last_snapshot, {:line_range => (issue.line-5)..(issue.line+5), :highlighted_lines => [issue.line]}) -%>
+ </div>
+ <% end %>
+
+ <div class="discussion marginbottom10">
+ <div class="discussionComment first">
+ <%= h(issue.description) -%>
+ </div>
+ </div>
+
</div>
\ No newline at end of file
# hack in case 'error_message' is nil (this should disappear when refactoring the '_view' and '_issue' partials)
error_message = error_message
%>
- <%= render :partial => 'issue/issue', :locals => {:issue => @issue, :rule => @rule, :resource => @resource, :workflow => @issue, :error_message => error_message} -%>
+ <%= render :partial => 'issue/issue', :locals => {:issue => issue, :rule => rule, :resource => resource, :workflow => issue, :project => project, :error_message => error_message} -%>
</div>
<%
displayed_resource = @resource || @project
+ display_only_root = @review || @issue
%>
<% if @breadcrumbs %>
<div id="crumbs">
<ul id="crumbs-ops">
- <% if displayed_resource && !@review %>
+ <% if displayed_resource && !display_only_root %>
<li>
<%= link_to_favourite(displayed_resource) -%>
</li>
<div id="crumbs">
<ul id="crumbs-ops">
- <% if displayed_resource && !@review %>
+ <% if displayed_resource && !display_only_root %>
<li>
<%= link_to_favourite(displayed_resource) -%>
</li>
<ul id="bc">
<%
resource_link = {}
- if @review
+ if display_only_root
resource_link = {:controller => 'dashboard', :action => 'index'}
end
<li>
<%= link_to message('review') + ' #' + @review.id.to_s -%>
</li>
+ <%
+ end
+
+ # ======== Path for issue ========
+ if @issue
+ %>
+ <li>
+ <%= link_to message('issue') + ' #' + @issue.key.to_s -%>
+ </li>
<%
end
%>