diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-03-05 12:20:28 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-03-05 12:20:28 +0100 |
commit | 2e3f0253f0bdcf995637cb83a5dd246c63df8abd (patch) | |
tree | c07eb931f9f89f6c9f207da840c3d69b1deab78b /sonar-server | |
parent | 274b6608415ca828981de87f42b4ff9ea070d207 (diff) | |
download | sonarqube-2e3f0253f0bdcf995637cb83a5dd246c63df8abd.tar.gz sonarqube-2e3f0253f0bdcf995637cb83a5dd246c63df8abd.zip |
Fix issue when rendering Design page
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb | 3 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/javascripts/application.js | 84 |
2 files changed, 46 insertions, 41 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb index 5f6c175be1d..f1ba5bc0a8c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb @@ -1,3 +1,6 @@ +<%= render :partial => 'gwt/base', :locals => {:resource => @resource, :popup => true, :metric => (@metric ? @metric.key : nil)} -%> +<%= render :partial => 'gwt/resource_viewers' -%> + <div id="accordion-panel"/> <script type="text/javascript"> diff --git a/sonar-server/src/main/webapp/javascripts/application.js b/sonar-server/src/main/webapp/javascripts/application.js index c72312a32f2..c687803fe4b 100644 --- a/sonar-server/src/main/webapp/javascripts/application.js +++ b/sonar-server/src/main/webapp/javascripts/application.js @@ -354,53 +354,55 @@ function openAccordionItem(url, elt, updateCurrentElement) { } // Get content from url - var ajaxRequest = $j.get(url,function (html) { - if (currentElement.length) { - var body = currentElement.find('.accordion-item-body'); - if (!updateCurrentElement && !body.hasClass('accordion-item-body-medium')) { - body.addClass("accordion-item-body-medium"); - elt.scrollIntoView(false); - } - } else { - $j("#accordion-panel").height('auto'); - } - - if (updateCurrentElement) { - // Fix the height in order to not change the position on the screen - var prevHeight = $j("#accordion-panel").height(); - currentElement.html(html); - $j("#accordion-panel").height('auto'); - var newHeight = $j("#accordion-panel").height(); - if (prevHeight > newHeight) { - $j("#accordion-panel").height(prevHeight); - } else { - $j("#accordion-panel").height(newHeight); - } - } else { - // Add new item add the end of the panel and restore the height param - var nbElement = $j("."+htmlClass).size(); - var newElement = $j('<div id="'+ htmlClass + nbElement +'" class="'+ htmlClass +'">'); - newElement.html(html); - - $j("#accordion-panel").append(newElement); - $j("#accordion-panel").height('auto'); - - // Set the focus on the top of the current item with animation - if (currentElement.length) { - $j('html, body').animate({ - scrollTop: currentElement.offset().top}, 500 - ); - } - } - }).fail(function (jqXHR, textStatus) { + var ajaxRequest = $j.ajax({ + url: url + }).fail(function (jqXHR, textStatus) { alert("Server error. Please contact your administrator. The status of the error is : "+ jqXHR.status); - }).done(function () { + }).done(function (html) { + if (currentElement.length) { + var body = currentElement.find('.accordion-item-body'); + if (!updateCurrentElement && !body.hasClass('accordion-item-body-medium')) { + body.addClass("accordion-item-body-medium"); + elt.scrollIntoView(false); + } + } else { + $j("#accordion-panel").height('auto'); + } + + if (updateCurrentElement) { + // Fix the height in order to not change the position on the screen + var prevHeight = $j("#accordion-panel").height(); + currentElement.html(html); + $j("#accordion-panel").height('auto'); + var newHeight = $j("#accordion-panel").height(); + if (prevHeight > newHeight) { + $j("#accordion-panel").height(prevHeight); + } else { + $j("#accordion-panel").height(newHeight); + } + } else { + // Add new item add the end of the panel and restore the height param + var nbElement = $j("."+htmlClass).size(); + var newElement = $j('<div id="'+ htmlClass + nbElement +'" class="'+ htmlClass +'">'); + $j("#accordion-panel").append(newElement); + + // Add html after having adding the new element in the page in order to scripts (for instance for GWT) to be well executed + newElement.append(html); + $j("#accordion-panel").height('auto'); + + // Set the focus on the top of the current item with animation + if (currentElement.length) { + $j('html, body').animate({ + scrollTop: currentElement.offset().top}, 500 + ); + } + } loading.remove(); }); - return ajaxRequest; } + function expandAccordionItem(elt) { var currentElement = $j(elt).closest('.accordion-item'); currentElement.find('.accordion-item-body').removeClass("accordion-item-body-medium"); |