]> source.dussan.org Git - sonarqube.git/commitdiff
Do not display 'New window' in popup mode
authorJulien Lancelot <julien.lancelot@gmail.com>
Thu, 7 Feb 2013 09:22:18 +0000 (10:22 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Thu, 7 Feb 2013 09:22:18 +0000 (10:22 +0100)
sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/test_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable_working_view.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase_working_view.html.erb [deleted file]
sonar-server/src/main/webapp/javascripts/resource.js

index 50e25733ceae306b918c33c6b1da3a5ef768f5f6..61b14bd02541113c13064954257dbd2ccca9b353 100644 (file)
@@ -37,6 +37,7 @@ class ResourceController < ApplicationController
       access_denied unless has_role?(:user, @resource)
 
       @snapshot=@resource.last_snapshot
+      @popup_mode = params[:popup] == 'true'
 
       if @snapshot
         load_extensions()
@@ -63,7 +64,10 @@ class ResourceController < ApplicationController
       else
         render_resource_deleted()
       end
+    # popup mode
     else
+      # Always display title in popup mode
+      @params_opts = '&popup=true&display_title=true'
       params[:layout] = 'false'
       render :action => 'index'
     end
index 2d8f4e2512576858d932f477dbf8f6d1146215cb..388cb8d3782a305a8926de141634696a6b3d0785 100644 (file)
@@ -27,7 +27,7 @@ class TestController < ApplicationController
     @test = params[:test].to_s
     @test_plan = java_facade.testPlan(snapshot_id)
     @test_case = @test_plan.testCasesByName(@test).first
-    render :partial => 'test/testcase_working_view'
+    render :partial => 'test/testcase'
   end
 
   def testable
@@ -45,7 +45,7 @@ class TestController < ApplicationController
       test_cases << test_case
       @test_case_by_test_plan[test_plan] = test_cases
     end
-    render :partial => 'test/testable_working_view'
+    render :partial => 'test/testable'
   end
 
 end
\ No newline at end of file
index a1b01446a25707c9d28095ebf7c7469d6b0354b1..bcd361042d6ed075db97a499bf778689a6319f68 100644 (file)
         </li>
       <% first=false
          end %>
+      <% unless @popup_mode %>
       <li class="<%= 'first' if first -%>">
         <a href="<%= ApplicationController.root_context -%>/resource/index/<%= @resource.key -%>?display_title=true" onclick="window.open(this.href,'resource','height=800,width=900,scrollbars=1,resizable=1');return false;"><%= message('new_window') -%></a>
       </li>
+      <% end %>
     </ul>
     <ul class="tabs2">
       <% @extensions.each do |extension| %>
index 4991755d32b315c8af2798b2c44f6ab459b9f930..4372f5fd24c3babf087ad2dfe45435cecf877691 100644 (file)
@@ -1,5 +1,5 @@
 <div id="accordion-panel"/>
 
 <script type="text/javascript">
-  openAccordionItem('<%= request.request_uri -%>', this);
+  openAccordionItem('<%= request.request_uri + @params_opts.to_s -%>', this);
 </script>
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb
new file mode 100644 (file)
index 0000000..9af43f4
--- /dev/null
@@ -0,0 +1,33 @@
+<div class="accordion-item">
+  <div class="accordion-item-header">
+    <div class="source_title">
+      <div class="subtitle">Tests covering <%= @testable.component.longName %> on line <%= @line %></div>
+    </div>
+  </div>
+  <div class="accordion-item-body">
+    <% @test_case_by_test_plan.sort_by { |test_plan, test_cases| test_plan.component.longName }.each do |test_plan, test_cases| %>
+      <% resource_key = test_plan.component.key %>
+      <a href="<%= ApplicationController.root_context -%>/resource/index/<%= resource_key -%>?display_title=true&tab=source"
+         onclick="openAccordionItem(this.href, this); return false;"><%= test_plan.component.longName %>
+      </a>
+      <table class="data marginbottom10">
+        <tbody>
+        <% reset_cycle %>
+        <% test_cases.sort_by { |test_case| test_case.name }.each do |test_case|
+            reset_cycle
+        %>
+          <tr class="<%= cycle('even', 'odd') -%>">
+            <td class="thin" nowrap>
+              <img src="<%= ApplicationController.root_context + "/images/test/" + test_case.status.name + ".png" -%>"/>
+            </td>
+            <td class="thin right" nowrap><%= test_case.durationInMs -%> ms</td>
+            <td>
+              <%= test_case.name -%>
+            </td>
+          </tr>
+        <% end %>
+        </tbody>
+      </table>
+    <% end %>
+  </div>
+</div>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable_working_view.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable_working_view.html.erb
deleted file mode 100644 (file)
index 9af43f4..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<div class="accordion-item">
-  <div class="accordion-item-header">
-    <div class="source_title">
-      <div class="subtitle">Tests covering <%= @testable.component.longName %> on line <%= @line %></div>
-    </div>
-  </div>
-  <div class="accordion-item-body">
-    <% @test_case_by_test_plan.sort_by { |test_plan, test_cases| test_plan.component.longName }.each do |test_plan, test_cases| %>
-      <% resource_key = test_plan.component.key %>
-      <a href="<%= ApplicationController.root_context -%>/resource/index/<%= resource_key -%>?display_title=true&tab=source"
-         onclick="openAccordionItem(this.href, this); return false;"><%= test_plan.component.longName %>
-      </a>
-      <table class="data marginbottom10">
-        <tbody>
-        <% reset_cycle %>
-        <% test_cases.sort_by { |test_case| test_case.name }.each do |test_case|
-            reset_cycle
-        %>
-          <tr class="<%= cycle('even', 'odd') -%>">
-            <td class="thin" nowrap>
-              <img src="<%= ApplicationController.root_context + "/images/test/" + test_case.status.name + ".png" -%>"/>
-            </td>
-            <td class="thin right" nowrap><%= test_case.durationInMs -%> ms</td>
-            <td>
-              <%= test_case.name -%>
-            </td>
-          </tr>
-        <% end %>
-        </tbody>
-      </table>
-    <% end %>
-  </div>
-</div>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb
new file mode 100644 (file)
index 0000000..f3a2f96
--- /dev/null
@@ -0,0 +1,30 @@
+<div class="accordion-item">
+  <div class="accordion-item-header">
+    <h3>Files covered by <%= @test %> (<%= @test_plan.component.longName %>)</h3>
+  </div>
+  <br/>
+  <div class="accordion-item-body">
+    <table class="data">
+      <thead>
+      <tr>
+        <th>File</th>
+        <th>Covered Lines</th>
+      </tr>
+      </thead>
+      <tbody>
+      <% @test_case.coverageBlocks.sort_by{|cover| cover.testable.component.name}.each do |cover|
+          reset_cycle
+      %>
+      <tr class="<%= cycle("even", "odd") -%>">
+        <td>
+          <a href="<%= ApplicationController.root_context -%>/resource/index/<%= cover.testable.component.key -%>?display_title=true&tab=coverage&coverage_filter=lines_covered_per_test&test_case_filter=<%= @test -%>"
+             onclick="openAccordionItem(this.href, this); return false;"><%= cover.testable.component.longName -%>
+          </a>
+        </td>
+        <td><%= cover.lines.size -%></td>
+      </tr>
+      <% end %>
+      </tbody>
+    </table>
+  </div>
+</div>
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase_working_view.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase_working_view.html.erb
deleted file mode 100644 (file)
index f3a2f96..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<div class="accordion-item">
-  <div class="accordion-item-header">
-    <h3>Files covered by <%= @test %> (<%= @test_plan.component.longName %>)</h3>
-  </div>
-  <br/>
-  <div class="accordion-item-body">
-    <table class="data">
-      <thead>
-      <tr>
-        <th>File</th>
-        <th>Covered Lines</th>
-      </tr>
-      </thead>
-      <tbody>
-      <% @test_case.coverageBlocks.sort_by{|cover| cover.testable.component.name}.each do |cover|
-          reset_cycle
-      %>
-      <tr class="<%= cycle("even", "odd") -%>">
-        <td>
-          <a href="<%= ApplicationController.root_context -%>/resource/index/<%= cover.testable.component.key -%>?display_title=true&tab=coverage&coverage_filter=lines_covered_per_test&test_case_filter=<%= @test -%>"
-             onclick="openAccordionItem(this.href, this); return false;"><%= cover.testable.component.longName -%>
-          </a>
-        </td>
-        <td><%= cover.lines.size -%></td>
-      </tr>
-      <% end %>
-      </tbody>
-    </table>
-  </div>
-</div>
\ No newline at end of file
index 5f5347d2d4ad75fffc922e143134cc5cbe0eaf64..de24fde7194b882fb8b030f8ab37b6c787b47790 100644 (file)
@@ -187,6 +187,7 @@ function hVF(elt, line) {
  Functions used in tests viewer
  */
 function expandTests(index, elt){
+  expandAccordionItem(elt);
   var parent = $j(elt).closest('.test_name_'+index);
   parent.find(".test_expandLink_"+ index).hide();
   parent.find(".test_collapseLink_"+ index).show();
@@ -194,6 +195,7 @@ function expandTests(index, elt){
 }
 
 function collapseTests(index, elt){
+  expandAccordionItem(elt);
   var parent = $j(elt).closest('.test_name_'+index);
   parent.find(".test_collapseLink_"+ index).hide();
   parent.find(".test_expandLink_"+ index).show();