]> source.dussan.org Git - sonarqube.git/commitdiff
Do not display sidebar when zooming on a file
authorJulien Lancelot <julien.lancelot@gmail.com>
Tue, 12 Feb 2013 10:28:57 +0000 (11:28 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Tue, 12 Feb 2013 10:29:18 +0000 (11:29 +0100)
sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
sonar-server/src/main/webapp/javascripts/application.js

index 8ad90815c07b26e0270922992125530dcd2fc718..35384ae8095b94800f70a6592cb5a7a38982d2a5 100644 (file)
@@ -31,7 +31,8 @@ class DashboardController < ApplicationController
       load_dashboard()
       load_authorized_widget_definitions()
     elsif @snapshot
-      # display the layout of the parent, usually the directory, but display the file viewers
+      # display the layout of the parent without the sidebar, usually the directory, but display the file viewers
+      @hide_sidebar = true
       @file = @resource
       @project = @snapshot.parent.project
       render :action => 'no_dashboard'
index be9f086e5858c495a201d8a5da00836723c967c3..e125579a9e4064f7f5ed3874b44c0fd7b6fa4363 100644 (file)
@@ -1,10 +1,10 @@
 <%= render :partial => 'gwt/base', :locals => {:resource => nil, :popup => false, :metric => nil} -%>
 <%= render :partial => 'gwt/resource_viewers' -%>
 
-<img id="page_loading" src="<%= ApplicationController.root_context -%>/images/loading.gif">
-<div id="resource_container"></div>
+<div id="accordion-panel"></div>
 
 <script type="text/javascript">
+
   // see if an anchor has been passed
   var anchor;
   var stripped_url = document.location.toString().split("#");
     anchor = stripped_url[1];
   }
 
-  // and call the resource page
-  new Ajax.Updater('resource_container', '<%= url_for params.merge({:controller => 'resource', :action => :index, :id => @file.id}) -%>',
-    {
-      asynchronous:true,
-      evalScripts:true,
-      onComplete:function (transport) {
-        $('page_loading').hide();
+  openAccordionItem('<%= url_for(params.merge({:controller => 'resource', :action => :index, :id => @file.id, :display_title => 'false', :popup => 'false'})) -%>', this, false)
+      .done(function () {
         if (anchor != null) {
           window.location.hash = anchor;
         }
-      }
-    });
+      });
+
 </script>
index 1cef87926938295838cf08379a8c1528a0dce20c..e5a4e6cb113cd6540b602f3a1f4615fad50a3eac 100644 (file)
@@ -40,6 +40,8 @@
   
 <% elsif displayed_resource %>
 
+  <% puts "### dis "+ displayed_resource.to_s %>
+
   <div id="crumbs">
     <ul id="crumbs-ops">
       <% if displayed_resource && !@review %>
index 1434353b822042375ef29bc70273bc7c46883221..9bb70302df7d1d98bfefba7fe4c2225c9389f7e9 100644 (file)
@@ -41,7 +41,7 @@
   </div>
   <%= render 'layouts/breadcrumb' if @breadcrumbs || selected_section==Navigation::SECTION_RESOURCE -%>
   <div id="body">
-    <% if selected_section %>
+    <% if selected_section && (!@hide_sidebar) %>
       <div id="sidebar">
         <ul class="sidebar blue-sidebar">
           <% if selected_section==Navigation::SECTION_HOME %>
         </ul>
       </div>
     <% end %>
-    <div <%= "id='content' class='with_sidebar'" if selected_section -%>>
+    <%
+      html_id_class = ''
+      html_id_class = "id='content' class='with_sidebar'" if selected_section
+      html_id_class = "id='content'" if @hide_sidebar
+    %>
+    <div <%= html_id_class -%>>
       <% if @project %>
         <div class="print"><h2><%= h @project.name(true) %></h2></div>
       <% end %>
index 4d8f272d273920b58563c0e8f5d62d020ad0577a..7fb13201a7c77d1c2a131c29521b2777b81a7c7b 100644 (file)
@@ -355,7 +355,7 @@ function openAccordionItem(url, elt, updateCurrentElement) {
   }
 
   // Get content from url
-  $j.get(url,function (html) {
+  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')) {
@@ -392,7 +392,7 @@ function openAccordionItem(url, elt, updateCurrentElement) {
         loading.remove();
       });
 
-  return false;
+  return ajaxRequest;
 }
 
 function expandAccordionItem(elt) {