]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4919 Stay on issues tab after bulk change
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Fri, 31 Jan 2014 15:43:09 +0000 (16:43 +0100)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Fri, 31 Jan 2014 15:43:15 +0000 (16:43 +0100)
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb
sonar-server/src/main/webapp/javascripts/application.js

index 25153f957112425a3aa652dae2c19870a414eefc..57fedba78a24b4124b6ac9218a6c38df288c6fa8 100644 (file)
@@ -21,7 +21,7 @@
 
   // refresh page after issues bulk change
   function onBulkIssues(){
-    window.location.reload();
+    resourceViewerOnBulkIssues();
   }
 
 </script>
index 29513590ee8789b12f3adbd2e7704f862fb41109..14063a4d4c24b3e9de91d262892f843c3aaf83a1 100644 (file)
@@ -11,6 +11,7 @@
 
   // refresh page after issues bulk change
   function onBulkIssues(){
-    window.location.reload();
+    resourceViewerOnBulkIssues();
   }
+
 </script>
index 9943ee25222e5b0d5adfb9db25c358b98dd455e5..ae00c85ab4ce01e0b1df213e1bfbc2f56a1d3b9c 100644 (file)
@@ -63,6 +63,27 @@ function autocompleteResources() {
   });
 }
 
+function resourceViewerOnBulkIssues() {
+  var issuesTab = 'tab=issues';
+  if (window.location.search.indexOf('tab=') >= 0) {
+    // If a tab is already selected
+    if (window.location.search.indexOf(issuesTab) >= 0) {
+      // If tab is issues, keep it and reload page
+      window.location.reload();
+    } else {
+      // Else, switch to issues tab
+      window.location.search = window.location.search.replace(/tab=\w+/, issuesTab);
+    }
+  } else {
+    // No tab selected, see how to add tab parameter
+    if (window.location.search.startsWith('?')) {
+      window.location.search += ('&' + issuesTab);
+    } else {
+      window.location.search += ('?' + issuesTab);
+    }
+  }
+}
+
 var SelectBox = {
   cache: new Object(),
   init: function (id) {