summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2012-03-13 10:51:01 +0100
committerFabrice Bellingard <bellingard@gmail.com>2012-03-13 10:51:01 +0100
commit61219df99b0c4770ccd5a819de52f1f8bb4c4e52 (patch)
tree4ecc2ed5dface88b0e371fd8c26ec5f49f7b6a9b
parent9435bfa417b9d52b87fa0b2521550c0cd3426e6a (diff)
downloadsonarqube-61219df99b0c4770ccd5a819de52f1f8bb4c4e52.tar.gz
sonarqube-61219df99b0c4770ccd5a819de52f1f8bb4c4e52.zip
SONAR-3243 Rollback popup removal and put it in seperate GitHub repo
=> See https://github.com/bellingard/sonar/tree/popup-removal to test the removal of automatic-popup links
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb19
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/components/index.html.erb7
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications_source_snippet.html.erb2
4 files changed, 23 insertions, 9 deletions
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 5463fe9e32a..17b0894601b 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
@@ -320,17 +320,26 @@ module ApplicationHelper
#
#
- # link to the current page with the given resource.
+ # link to the current page with the given resource. If file, then open a popup to display resource viewers.
#
#
def link_to_resource(resource, name=nil, options={})
period_index=options[:period]
period_index=nil if period_index && period_index<=0
- if options[:line]
- anchor= 'L' + options[:line].to_s
+ 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, {:controller => 'dashboard', :action => 'index', :id => resource.id, :period => period_index,
- :tab => options[:tab], :rule => options[:rule], :anchor => anchor}, :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 3076abcf0bf..4ea90f9441a 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,10 +43,15 @@
<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) %>
- <%= link_to_resource(project, project.name) %>
+ <% if snapshot.display_dashboard? %>
+ <a href="<%= ApplicationController.root_context + "/dashboard/index/#{snapshot.project.id}" -%>"><%= snapshot.project.name -%></a>
+ <% else %>
+ <%= snapshot.project.name %>
+ <% end %>
</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 68ab903da18..bdd465d4e95 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)), {:title => @masterproject.project.key}) %>
+ <% 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_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), {:title => snapshot.project.key, :period => @filter_context.period_index}) %>
+ <%= qualifier_icon(snapshot) %> <%= link_to_resource(snapshot.project, snapshot.project.name(true), {:dashboard => 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/resource/_duplications_source_snippet.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications_source_snippet.html.erb
index eeab570dba4..a4c3490b177 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) -%>
+ <%= link_to_resource(parent_project, parent_project.path_name, {:dashboard => true}) -%>
&nbsp;&nbsp;
<%= qualifier_icon(resource) -%>
<%= link_to_resource(resource, resource.name(true), {:line => from_line}) -%>