diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-02-19 22:52:37 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-02-19 22:52:37 +0100 |
commit | 8e14501ecf8f21d3b271a91368454aed3c04516c (patch) | |
tree | 9407f4036b6fb42757340aed989fc78507363d8e | |
parent | 548d3ab217d6f862ff645a3e974dad516a693e1b (diff) | |
download | sonarqube-8e14501ecf8f21d3b271a91368454aed3c04516c.tar.gz sonarqube-8e14501ecf8f21d3b271a91368454aed3c04516c.zip |
SONAR-3040 Dispay the project/module along with the file path in the Code Viewer header
3 files changed, 20 insertions, 4 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb index 79ed708f2b3..9770cd07802 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb @@ -59,6 +59,13 @@ class Project < ActiveRecord::Base end end + # bottom-up array of projects, + def ancestor_projects + node, nodes = self, [] + nodes << node = node.root while node.root + nodes + end + def switch_resource @switch_resource ||= begin diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb index 104d8671a08..ad5fc2cb940 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb @@ -10,7 +10,7 @@ if (display_title == undefined) { display_title = true; } - new Ajax.Updater('resource_container', baseUrl + '/resource/index/' + resourceId + '?metric=<%= @metric.id if @metric -%>&rule=<%= @rule ? @rule.id : @severity -%>&period=<%= @period -%>&display_title=' + display_title, {asynchronous:true, evalScripts:true}); + new Ajax.Updater('resource_container', baseUrl + '/resource/index/' + resourceId + '?metric=<%= @metric.id if @metric -%>&rule=<%= @rule ? @rule.id : @severity -%>&period=<%= @period -%>&project=<%= @project.id -%>&display_title=' + display_title, {asynchronous:true, evalScripts:true}); return false; } </script> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb index d81137ec2e1..f1e4d260c2c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb @@ -3,8 +3,16 @@ if display_title %> <div id="source_title"> - <% if logged_in? %><%= link_to_favourite(@resource) -%><% end %> - <span class="h1"><%= qualifier_icon(@resource) -%> <%= @resource.name(true) -%></span> + <% + selected_project_id = params[:project].to_i + if @resource.project && selected_project_id != @resource.project.id %> + <div class="subtitle"> + <%= @resource.ancestor_projects.select{|p| p.id != selected_project_id}.reverse.map{|p| p.name(true)}.join(' / ') -%> + </div> + <% end %> + <% if logged_in? %><%= link_to_favourite(@resource) -%> + <% end %> + <span class="h3"><%= qualifier_icon(@resource) -%> <%= @resource.name(true) -%></span> </div> <% end %> @@ -14,7 +22,8 @@ first=true if @snapshot.source %> - <li class="<%= 'first' if first -%>"><a href="<%= ApplicationController.root_context -%>/api/sources?resource=<%= @resource.key -%>&format=txt"><%= message('raw') -%></a> + <li class="<%= 'first' if first -%>"> + <a href="<%= ApplicationController.root_context -%>/api/sources?resource=<%= @resource.key -%>&format=txt"><%= message('raw') -%></a> </li> <% first=false end |