]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2342 Keep only root resources in the recent activity
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Mon, 10 Dec 2012 10:09:28 +0000 (11:09 +0100)
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Mon, 10 Dec 2012 10:09:28 +0000 (11:09 +0100)
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_menu_projects.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb

index 32f7f4bafb37fcccd7e93ab84bc514b03de5b1eb..ec8a68e1f8dbfaaf45a679514d21ff0c3da11106 100644 (file)
 <script>
   if (sonarRecentHistory == null) {
     $j('#recent-history').detach();
-  } else {
-    sonarRecentHistory.add('<%= @resource ? @resource.key : "" -%>', 
-                           '<%= @resource ? @resource.name : "" -%>', 
-                           '<%= @resource ? Api::Utils.java_facade.getResourceType(@resource.qualifier).getIconPath() : "" -%>');
   }
+  
+  <% 
+     if @resource
+       # we keep only root resources in the "Recent activity"
+       root_resource = @resource.root_project
+  %>
+  else {
+    sonarRecentHistory.add('<%= root_resource.key -%>', 
+                           '<%= root_resource.name -%>', 
+                           '<%= Api::Utils.java_facade.getResourceType(root_resource.qualifier).getIconPath() -%>');
+  }
+  <% end %>
+  
 </script>
\ No newline at end of file
index 0765a7da521b0c6b485dd5a4857215a4a961951f..1f452a265e91bb9f210d1a1a5e74bb27a0860a83 100644 (file)
@@ -1,11 +1,3 @@
-<script>
-  if (sonarRecentHistory != null) {
-    sonarRecentHistory.add('<%= @resource.key -%>', 
-                           '<%= @resource.name -%>', 
-                           '<%= @resource ? Java::OrgSonarServerUi::JRubyFacade.getInstance().getResourceType(@resource.qualifier).getIconPath() : "" -%>');
-  }  
-</script>
-
 <%= render :partial => 'tabs' -%>
 <%= render :partial => "resource/header_#{@extension.getId()}" -%>