From: Julien Lancelot Date: Fri, 24 May 2013 09:49:28 +0000 (+0200) Subject: SONAR-4303 Refactor the issue detail page X-Git-Tag: 3.6~279 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=766cba3df7c6187be9f6b1dc8f1c9a0b5afe51be;p=sonarqube.git SONAR-4303 Refactor the issue detail page --- 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 @@ +
+
+
+

Issue #<%= issue.key %>

+

<%= h issue_results.project(issue).name -%>

+

<%= h issue_results.component(issue).name -%>

+
+ +
+ <%= render :partial => 'issue/issue', :locals => {:issue => issue_results.issues.get(0)} -%> +
+ + <% if snapshot && issue.line%> +
+ <%= snapshot_html_source(snapshot, {:line_range => (issue.line-5)..(issue.line+5), :highlighted_lines => [issue.line]}) -%> +
+ <% end %> +
+
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 @@ -
- <%= render :partial => 'issue/issue', :locals => {:issue => @issue_results.issues.get(0)} -%> -
\ 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 @@ +
+ <%= render :partial => 'issue/view', :locals => {:issue => @issue, :issue_results => @issue_results, :snapshot => @snapshot} -%> +
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 -%> - <%= link_to h(truncate(issue.message, :length => 100)), :controller => 'issue', :action => 'view', :id => issue.key -%> + 'view', :id => issue.key %>'> + <%= h truncate(issue.message, :length => 100) -%> <%= 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 @@ - <%= link_to h(issue.message()), :controller => "issue", :action => "view", :id => issue.key() -%> + 'view', :id => issue.key %>'> + <%= h truncate(issue.message, :length => 100) -%> <% if last_comment %>