From 6d7f9d331509f1712d6177a97b8d75fe9373be71 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Wed, 20 Jun 2012 13:47:37 +0200 Subject: [PATCH] SONAR-3595 Support resizing of browser window (Timeline and Treemap) --- .../org/sonar/plugins/core/widgets/timeline.html.erb | 5 ++++- .../app/views/treemap/_treemap_container.html.erb | 9 +++++++-- sonar-server/src/main/webapp/javascripts/dashboard.js | 11 +++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb index e1cc75ddbb7..cdfe4275d32 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb @@ -176,9 +176,12 @@ .events(events); timeline.render(); + autoResize(200, function() { + timeline.render(); + }); <% end - end + end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/treemap/_treemap_container.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/treemap/_treemap_container.html.erb index 2afabddf5e7..24f9dab2f3e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/treemap/_treemap_container.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/treemap/_treemap_container.html.erb @@ -29,6 +29,11 @@ diff --git a/sonar-server/src/main/webapp/javascripts/dashboard.js b/sonar-server/src/main/webapp/javascripts/dashboard.js index d2fa3fd15ac..9f14490c8b9 100644 --- a/sonar-server/src/main/webapp/javascripts/dashboard.js +++ b/sonar-server/src/main/webapp/javascripts/dashboard.js @@ -113,3 +113,14 @@ Portal.prototype = { } }; +autoResize = function(everyMs, callback) { + var resizeTimer = null; + Event.observe(window, 'resize', function() { + if (resizeTimer == null) { + resizeTimer = window.setTimeout(function() { + resizeTimer = null; + callback(); + }, everyMs); + } + }); +}; -- 2.39.5