From: Simon Brandhof Date: Thu, 30 May 2013 13:18:16 +0000 (+0200) Subject: Permalinks on issue and rule details for Eclipse plugin X-Git-Tag: 3.6~172 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cd46e17bea493e095c4d11609351407387814825;p=sonarqube.git Permalinks on issue and rule details for Eclipse plugin --- 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 9ce1deeb8ac..4a0854f76aa 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 @@ -27,18 +27,25 @@ class IssueController < ApplicationController init_issue if request.xhr? - render :partial => 'issue/view', :locals => {:issue => @issue, :issue_results => @issue_results, :snapshot => @snapshot} + render :partial => 'issue/view', :locals => {:issue => @issue, :issue_results => @issue_results, :snapshot => @snapshot, :show_source => true} else render :action => 'view' end end - # Used in Eclipse Plugin + # GET /issue/show/ + # This URL is used by the Eclipse Plugin + # + # ==== Optional parameters + # 'layout' is false to remove sidebar and headers. Default value is true. + # 'source' is false to hide source code. Default value is true. + # + # ==== Example + # GET /issue/show/151f6853-58a1-4950-95e3-9866f8be3e35?layout=false&source=false + # def show require_parameters :id init_issue - - params[:layout] = 'false' render :action => 'view' end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_controller.rb index cd7cd9d521f..8959be52f6d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_controller.rb @@ -20,8 +20,18 @@ class RulesController < ApplicationController SECTION=Navigation::SECTION_CONFIGURATION - + + # GET /rules/show/ + # This URL is used by the Eclipse plugin + # + # ==== Optional parameters + # 'layout' is false to remove sidebar and headers + # + # Example: GET /rules/show/squid:AvoidCycles + # def show + require_parameters :id + @key=params[:id] if @key.to_i==0 parts=@key.split(':') @@ -32,8 +42,7 @@ class RulesController < ApplicationController @page_title=@rule.name if @rule if params[:modal] == 'true' - render :partial => 'show' + render :partial => 'show_modal' end end - end 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 index 909b99be16a..27a6ec1f630 100644 --- 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 @@ -10,7 +10,7 @@ <%= render :partial => 'issue/issue', :locals => {:issue => issue_results.issues.get(0)} -%> - <% if snapshot && issue.line%> + <% if snapshot && issue.line && show_source %>
<%= snapshot_html_source(snapshot, {:line_range => (issue.line-5)..(issue.line+5), :highlighted_lines => [issue.line]}) -%>
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 index f1b5c7f9bdf..12044218f4a 100644 --- 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 @@ -1,3 +1,3 @@
- <%= render :partial => 'issue/view', :locals => {:issue => @issue, :issue_results => @issue_results, :snapshot => @snapshot} -%> + <%= render :partial => 'issue/view', :locals => {:issue => @issue, :issue_results => @issue_results, :snapshot => @snapshot, :show_source => params[:source]!='false'} -%>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules/_show.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules/_show.html.erb deleted file mode 100644 index 43cd943c19b..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules/_show.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -<% if @rule %> - - - - -<% else %> - -<% end %> - - - - diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules/_show_modal.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules/_show_modal.html.erb new file mode 100644 index 00000000000..43cd943c19b --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules/_show_modal.html.erb @@ -0,0 +1,47 @@ +<% if @rule %> + + + + +<% else %> + +<% end %> + + + +