]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3755 Fix breadcrumb on issue detail and add source code
authorJulien Lancelot <julien.lancelot@gmail.com>
Mon, 29 Apr 2013 16:12:54 +0000 (18:12 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Mon, 29 Apr 2013 16:12:54 +0000 (18:12 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/issue/_view.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb

index a693662604997713f97feb1745c33f2b03186589..17863a5ea12a50a31610d7963732b0d9dd65d578 100644 (file)
@@ -64,6 +64,8 @@ hide=Hide
 identifier_abbreviated=Id
 inactive=Inactive
 info=Info
+issue=Issue
+issues=Issues
 inheritance=Inheritance
 key=Key
 language=Language
index 58a1959683e95577d59bbabb0583c463f789ff94..fb5f77b22911b6c8a147fae4e06ce0ef503d276d 100644 (file)
@@ -22,14 +22,22 @@ class IssueController < ApplicationController
 
   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
index fb18dabbf954b54026c9a62fe84e1a25c4ab523e..907b43d69f52eb2c96a667e22591470d5320c87f 100644 (file)
@@ -75,8 +75,8 @@
       </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
index d1448cf5aa32b8ebda3dabf5eadcec482d09bb3c..1476be4d3f96baa8340528764ebacd67b38203e0 100644 (file)
@@ -3,5 +3,5 @@
     # 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>
index 6801f1df449f7261a08cc7baaaece1c3f75f9c63..27702b255cb30ff7f8396b49868992b2069b0bda 100644 (file)
@@ -1,12 +1,13 @@
 <%
    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>
@@ -42,7 +43,7 @@
 
   <div id="crumbs">
     <ul id="crumbs-ops">
-      <% if displayed_resource && !@review %>
+      <% if displayed_resource && !display_only_root %>
         <li>
           <%= link_to_favourite(displayed_resource) -%>
         </li>
@@ -54,7 +55,7 @@
     <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
       %>