Hide this/other/both legend if only one pipeline_instance is shown.
authorTom Clegg <tom@curoverse.com>
Mon, 3 Feb 2014 22:52:10 +0000 (14:52 -0800)
committerTom Clegg <tom@curoverse.com>
Mon, 3 Feb 2014 22:56:50 +0000 (14:56 -0800)
apps/workbench/app/controllers/pipeline_instances_controller.rb
apps/workbench/app/views/pipeline_instances/show.html.erb

index 1bb95e091afcabb043dc1336d25eea197fd9664f..a42a734394243d7deeab805e195348ef5e9d15fd 100644 (file)
@@ -4,11 +4,11 @@ class PipelineInstancesController < ApplicationController
   include PipelineInstancesHelper
 
   def show
-    pipelines = [@object]
+    @pipelines = [@object]
 
     if params[:compare]
       PipelineInstance.where(uuid: params[:compare]).each do |p|
-        pipelines << p
+        @pipelines << p
       end
     end
 
@@ -17,7 +17,7 @@ class PipelineInstancesController < ApplicationController
     pips = {}
     n = 1
 
-    pipelines.each do |p|
+    @pipelines.each do |p|
       collections = []
 
       p.components.each do |k, v|
index 84c1e30710381d3d893cd364513260586de7818b..cf56b9798d191e2cd571819712494da941ae8d0f 100644 (file)
@@ -65,11 +65,13 @@ table.pipeline-components-table div.progress {
   </tfoot>
 </table>
 
-<div style="text-align: center">
-<span class="pipeline_color_legend" style="background: #88ff88">This pipeline</span> 
-<span class="pipeline_color_legend" style="background: #8888ff">Comparison pipeline</span>
-<span class="pipeline_color_legend" style="background: #88ffff">Shared by both pipelines</span>
-</div>
+<% if @pipelines.count > 1 %>
+  <div style="text-align: center">
+    <span class="pipeline_color_legend" style="background: #88ff88">This pipeline</span> 
+    <span class="pipeline_color_legend" style="background: #8888ff">Comparison pipeline</span>
+    <span class="pipeline_color_legend" style="background: #88ffff">Shared by both pipelines</span>
+  </div>
+<% end %>
 
    <%= render partial: 'application/svg_div', locals: {
          divId: "provenance_graph",