]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2342 Find the right location for resource icon
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Thu, 29 Nov 2012 16:13:35 +0000 (17:13 +0100)
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Thu, 29 Nov 2012 16:13:35 +0000 (17:13 +0100)
=> It can be provided by a plugin (like DevCockpit), so the Java API
   must be used for that purpose.

sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb
sonar-server/src/main/webapp/javascripts/recent-history.js

index 705fe5158b236c8ce22941dbb9b9bd344d0ced05..c4c2635f0c6706ab453bf2749a35b0a67f461536 100644 (file)
@@ -45,6 +45,6 @@
   } else {
     sonarRecentHistory.add('<%= @resource ? @resource.key : "" -%>', 
                            '<%= @resource ? @resource.name(true) : "" -%>', 
-                           '<%= @resource ? @resource.qualifier : "" -%>');
+                           '<%= @resource ? Java::OrgSonarServerUi::JRubyFacade.getInstance().getResourceType(@resource.qualifier).getIconPath() : "" -%>');
   }
 </script>
\ No newline at end of file
index 9368502d87090fd835376e74adae92c2a6733c51..1bb4aed9c101713d50495690b1570da677596652 100644 (file)
@@ -23,11 +23,11 @@ Sonar.RecentHistory.prototype.clear = function () {
   localStorage.clear();
 };
   
-Sonar.RecentHistory.prototype.add = function (resourceKey, resourceName, resourceQualifier) {
+Sonar.RecentHistory.prototype.add = function (resourceKey, resourceName, iconPath) {
   var sonarHistory = this.getRecentHistory();
   
   if (resourceKey != '') {
-    var newEntry = {'key': resourceKey, 'name': resourceName, 'qualifier': resourceQualifier};
+    var newEntry = {'key': resourceKey, 'name': resourceName, 'iconPath': iconPath};
     // removes the element of the array if it exists
     for (i = 0; i < sonarHistory.length; i++) {
       var item = sonarHistory[i];
@@ -56,9 +56,8 @@ Sonar.RecentHistory.prototype.populateRecentHistoryPanel = function () {
     recentHistory.forEach(function (resource) {
       historyLinksList.append('<li><img width="16" height="16" src="'
                             + sonarRecentHistory.appContext
-                            + '/images/q/'
-                            + resource['qualifier']
-                            + '.png"><a href="'
+                            + resource['iconPath']
+                            + '"><a href="'
                             + sonarRecentHistory.appContext
                             + '/dashboard/index/'
                             + resource['key']