aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-05-24 11:49:28 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-05-24 11:49:28 +0200
commit766cba3df7c6187be9f6b1dc8f1c9a0b5afe51be (patch)
tree70fa107743931c2f681b9ee719831e1d31206b0d /sonar-server/src
parent4669f75edc9aaf3e81ed332190b358384458c409 (diff)
downloadsonarqube-766cba3df7c6187be9f6b1dc8f1c9a0b5afe51be.tar.gz
sonarqube-766cba3df7c6187be9f6b1dc8f1c9a0b5afe51be.zip
SONAR-4303 Refactor the issue detail page
Diffstat (limited to 'sonar-server/src')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb31
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issue/_view.html.erb19
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issue/show.html.erb3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issue/view.html.erb3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb3
6 files changed, 50 insertions, 12 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb
index fb28aded774..53f116b5b69 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb
@@ -20,21 +20,28 @@
class IssueController < ApplicationController
- SECTION=Navigation::SECTION_RESOURCE
+ helper SourceHelper
- def show
+ def view
require_parameters :id
+ init_issue
- @issue_results = Api.issues.find(params[:id])
if request.xhr?
- render :partial => 'issue/issue', :locals => {:issue => @issue_results.issues.get(0)}
+ render :partial => 'issue/view', :locals => {:issue => @issue, :issue_results => @issue_results, :snapshot => @snapshot}
else
- # Used in Eclipse Plugin
- params[:layout] = 'false'
- render :action => 'show'
+ render :action => 'view'
end
end
+ # Used in Eclipse Plugin
+ def show
+ require_parameters :id
+ init_issue
+
+ params[:layout] = 'false'
+ render :action => 'view'
+ end
+
# Form used for: assign, comment, transition, change severity and plan
def action_form
verify_ajax_request
@@ -155,4 +162,14 @@ class IssueController < ApplicationController
end
+ private
+
+ def init_issue
+ @issue_results = Api.issues.find(params[:id])
+ @issue = @issue_results.issues.get(0)
+
+ resource = Project.by_key(@issue.componentKey())
+ @snapshot = resource.last_snapshot if resource.last_snapshot
+ end
+
end \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_view.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_view.html.erb
new file mode 100644
index 00000000000..6180fbe83a2
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_view.html.erb
@@ -0,0 +1,19 @@
+<div id="content">
+ <div style="border: 1px solid #DDDDDD">
+ <div class="violations_header tab_header">
+ <h3>Issue #<%= issue.key %></h3>
+ <h3><%= h issue_results.project(issue).name -%></h3>
+ <h3><%= h issue_results.component(issue).name -%></h3>
+ </div>
+
+ <div class="marginbottom10">
+ <%= render :partial => 'issue/issue', :locals => {:issue => issue_results.issues.get(0)} -%>
+ </div>
+
+ <% if snapshot && issue.line%>
+ <div>
+ <%= snapshot_html_source(snapshot, {:line_range => (issue.line-5)..(issue.line+5), :highlighted_lines => [issue.line]}) -%>
+ </div>
+ <% end %>
+ </div>
+</div>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issue/show.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/show.html.erb
deleted file mode 100644
index 1c671f444b2..00000000000
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issue/show.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<div>
- <%= render :partial => 'issue/issue', :locals => {:issue => @issue_results.issues.get(0)} -%>
-</div> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issue/view.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/view.html.erb
new file mode 100644
index 00000000000..f1b5c7f9bdf
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/view.html.erb
@@ -0,0 +1,3 @@
+<div>
+ <%= render :partial => 'issue/view', :locals => {:issue => @issue, :issue_results => @issue_results, :snapshot => @snapshot} -%>
+</div>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb
index dea011f0b65..f091e51ceb8 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb
@@ -72,7 +72,8 @@
<%= message("issue.resolution.#{issue.resolution}") if issue.resolution -%>
</td>
<td>
- <%= link_to h(truncate(issue.message, :length => 100)), :controller => 'issue', :action => 'view', :id => issue.key -%>
+ <a class='open-modal rule-modal' modal-width='800' href='<%= url_for :controller => 'issue', :action => 'view', :id => issue.key %>'>
+ <%= h truncate(issue.message, :length => 100) -%></a>
</td>
<td>
<%= h (truncate(@filter.issues_result.project(issue).name, :length => 100)) -%>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb
index ed6f8fe3c3a..de3c97d44c0 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb
@@ -89,7 +89,8 @@
<tr class="<%= cycle 'even', 'odd', :name => ('issues-widget-list-' + widget_id) -%>">
<td><img src="<%= ApplicationController.root_context -%>/images/priority/<%= issue.severity() -%>.png" title="<%= message('severity.' + issue.severity()) -%>"/></td>
<td>
- <%= link_to h(issue.message()), :controller => "issue", :action => "view", :id => issue.key() -%>
+ <a class='open-modal rule-modal' modal-width='800' href='<%= url_for :controller => 'issue', :action => 'view', :id => issue.key %>'>
+ <%= h truncate(issue.message, :length => 100) -%></a>
<% if last_comment %>
<div class="comment-excerpt">
<img src="<%= ApplicationController.root_context -%>/images/reviews/comment.png"/>