diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2012-03-12 18:14:41 +0100 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2012-03-12 19:07:27 +0100 |
commit | fe6fcd42f0807c28b33d9fc04d520ae7b059b798 (patch) | |
tree | 2293202ff52b15b4810747d7b85fe92435433758 /sonar-server | |
parent | 18cf6708dd84434f12ddd5753696b63e45ea8f2b (diff) | |
download | sonarqube-fe6fcd42f0807c28b33d9fc04d520ae7b059b798.tar.gz sonarqube-fe6fcd42f0807c28b33d9fc04d520ae7b059b798.zip |
SONAR-3243 Wrong permalink & breadcrumbs when file is shown
- Permalinks have been moved to the latest part of the breadcrumb
- Breadcrumbs are now correct and show every part till the file
(if the resource being displayed is a file)
- All the links that used to open a file in a popup are now "regular"
links and open files in the default layout
=> for instance: links on files in the "component" page
Diffstat (limited to 'sonar-server')
7 files changed, 19 insertions, 45 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb index 83a3d3dfb88..ad1ce1fa10d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb @@ -35,11 +35,9 @@ class DashboardController < ApplicationController end else # display the layout of the parent, usually the directory, but display the file viewers - @file = @resource - @snapshot = @snapshot.parent_snapshot - if @snapshot - @resource = @snapshot.resource - @project = @resource + if @resource.last_snapshot + @file = @resource + @project = @resource.last_snapshot.parent.project render :action => 'no_dashboard' else redirect_to home_path diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 17b0894601b..f55ef40d90a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -326,20 +326,8 @@ module ApplicationHelper def link_to_resource(resource, name=nil, options={}) period_index=options[:period] period_index=nil if period_index && period_index<=0 - if resource.display_dashboard? - if options[:dashboard] - link_to(name || resource.name, {:overwrite_params => {:controller => 'dashboard', :action => 'index', :id => resource.id, :period => period_index, - :tab => options[:tab], :rule => options[:rule]}}, :title => options[:title]) - else - # stay on the same page (for example components) - link_to(name || resource.name, {:overwrite_params => {:id => resource.id, :period => period_index, :tab => options[:tab], :rule => options[:rule]}}, :title => options[:title]) - end - else - if options[:line] - anchor= 'L' + options[:line].to_s - end - link_to(name || resource.name, {:controller => 'resource', :action => 'index', :anchor => anchor, :id => resource.id, :period => period_index, :tab => options[:tab], :rule => options[:rule], :metric => options[:metric]}, :popup => ['resource', 'height=800,width=900,scrollbars=1,resizable=1'], :title => options[:title]) - end + link_to(name || resource.name, {:overwrite_params => {:controller => 'dashboard', :action => 'index', :id => resource.id, :period => period_index, + :tab => options[:tab], :rule => options[:rule]}}, :title => options[:title]) end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/components/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/components/index.html.erb index 4ea90f9441a..3076abcf0bf 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/components/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/components/index.html.erb @@ -43,15 +43,10 @@ <td width="1%" nowrap> <% if logged_in? %><%= link_to_favourite(project) -%> <% end %> - <%= link_to_resource(project, image_tag('zoom.png')) %> </td> <td class="left" x="<%= u(snapshot.project.name) -%>"> <%= qualifier_icon(snapshot) %> - <% if snapshot.display_dashboard? %> - <a href="<%= ApplicationController.root_context + "/dashboard/index/#{snapshot.project.id}" -%>"><%= snapshot.project.name -%></a> - <% else %> - <%= snapshot.project.name %> - <% end %> + <%= link_to_resource(project, project.name) %> </td> <% @columns.each do |column| %> <%= get_column_content(column, snapshot, @measures_by_snapshot) -%> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb index bdd465d4e95..68ab903da18 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb @@ -102,7 +102,7 @@ <%= trend_icon(measure, :empty => true) -%> <% end %> <% end %> - <% elsif column.on_name? %><%= qualifier_icon(@masterproject) %> <%= link_to_resource(@masterproject.project, h(@masterproject.project.name(true)), {:dashboard => true, :title => @masterproject.project.key}) %> + <% elsif column.on_name? %><%= qualifier_icon(@masterproject) %> <%= link_to_resource(@masterproject.project, h(@masterproject.project.name(true)), {:title => @masterproject.project.key}) %> <% elsif column.on_date? %><%= human_short_date(@masterproject.created_at) %> <% end %> </td> @@ -134,7 +134,7 @@ <% end %> <% end %> <% elsif column.on_name? %> - <%= qualifier_icon(snapshot) %> <%= link_to_resource(snapshot.project, snapshot.project.name(true), {:dashboard => true, :title => snapshot.project.key, :period => @filter_context.period_index}) %> + <%= qualifier_icon(snapshot) %> <%= link_to_resource(snapshot.project, snapshot.project.name(true), {:title => snapshot.project.key, :period => @filter_context.period_index}) %> <% elsif column.on_version? %><%= h snapshot.version %> <% elsif column.on_language? %><%= snapshot.project.language %> <% elsif column.on_date? %><%= human_short_date(snapshot.created_at) %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb index 59c9aa6eee1..aa46ec093c2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb @@ -1,26 +1,23 @@ <ol id="crumbs"> - <li><a href="<%= ApplicationController.root_context -%>/"><%= message('layout.home') -%></a></li> - <% -if @snapshot + <li><a href="<%= ApplicationController.root_context -%>/"><%= message('layout.home') -%></a></li> +<% +@resource = @project if @project && !@resource +if @resource && @resource.last_snapshot resources=[] - s=@snapshot + s=@resource.last_snapshot while (s!=nil) do resources<<s.project s=s.parent end - index=resources.size-1 - while (index>=0) do - resource=resources[index] + resources.reverse.each do |resource| %> - <li><%= qualifier_icon(resource) -%> <a href="<%= url_for :overwrite_params => { :id => resource.key } -%>"><%= h resource.name -%></a></li> + <li> + <%= qualifier_icon(resource) -%> <a href="<%= url_for :overwrite_params => { :id => resource.key } -%>"><%= h resource.name -%></a> + <%= link_to( image_tag('permalink.gif'), {:overwrite_params => { :id => resource.key }}, :title => message('layout.permalink')) if resource==@resource %> + </li> <% - index-=1 end -elsif @project -%> - <li><%= qualifier_icon(@project) -%> <a href="<%= url_for :overwrite_params => { :id => @project.key } -%>"><%= h @project.name -%></a></li> -<% end %> </ol>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb index ba02eba64ce..4e84f710ebe 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb @@ -13,10 +13,6 @@ </li> <li> <a href="javascript:window.print()"><img src="<%= ApplicationController.root_context -%>/images/print.gif" alt="<%= message('layout.print') -%>" title="<%= message('layout.print') -%>"/></a> - <% if @project %> - <a href="<%= url_for :overwrite_params => {:id => @project.key} -%>" id="permalink"> - <img src="<%= ApplicationController.root_context -%>/images/permalink.gif" alt="<%= message('layout.permalink') -%>" title="<%= message('layout.permalink') -%>"/></a> - <% end %> </li> <% if logged_in? %> <li> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications_source_snippet.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications_source_snippet.html.erb index a4c3490b177..eeab570dba4 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications_source_snippet.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications_source_snippet.html.erb @@ -5,7 +5,7 @@ %> <p> <%= qualifier_icon(parent_project) -%> - <%= link_to_resource(parent_project, parent_project.path_name, {:dashboard => true}) -%> + <%= link_to_resource(parent_project, parent_project.path_name) -%> <%= qualifier_icon(resource) -%> <%= link_to_resource(resource, resource.name(true), {:line => from_line}) -%> |