Move all index content into Recent and Help tabs.
authorTom Clegg <tom@curoverse.com>
Tue, 4 Feb 2014 10:25:45 +0000 (02:25 -0800)
committerTom Clegg <tom@curoverse.com>
Tue, 4 Feb 2014 10:25:45 +0000 (02:25 -0800)
refs #1979

22 files changed:
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/controllers/authorized_keys_controller.rb
apps/workbench/app/helpers/authorized_keys_helper.rb
apps/workbench/app/helpers/repositories_helper.rb
apps/workbench/app/helpers/virtual_machines_helper.rb
apps/workbench/app/models/collection.rb
apps/workbench/app/views/api_client_authorizations/_help.html.erb [moved from apps/workbench/app/views/api_client_authorizations/index.html.erb with 93% similarity]
apps/workbench/app/views/application/_recent.html.erb [moved from apps/workbench/app/views/application/_index.html.erb with 90% similarity]
apps/workbench/app/views/application/index.html.erb
apps/workbench/app/views/authorized_keys/_help.html.erb [new file with mode: 0644]
apps/workbench/app/views/authorized_keys/index.html.erb
apps/workbench/app/views/collections/_nav.html.erb [deleted file]
apps/workbench/app/views/collections/_recent.html.erb [moved from apps/workbench/app/views/collections/index.html.erb with 96% similarity]
apps/workbench/app/views/collections/show.html.erb
apps/workbench/app/views/jobs/_recent.html.erb [moved from apps/workbench/app/views/jobs/index.html.erb with 100% similarity]
apps/workbench/app/views/layouts/application.html.erb
apps/workbench/app/views/links/_recent.html.erb [moved from apps/workbench/app/views/links/index.html.erb with 100% similarity]
apps/workbench/app/views/pipeline_instances/_recent.html.erb [moved from apps/workbench/app/views/pipeline_instances/index.html.erb with 84% similarity]
apps/workbench/app/views/pipeline_instances/compare.html.erb
apps/workbench/app/views/pipeline_templates/_recent.html.erb [moved from apps/workbench/app/views/pipeline_templates/index.html.erb with 100% similarity]
apps/workbench/app/views/repositories/_help.html.erb [moved from apps/workbench/app/views/repositories/index.html.erb with 94% similarity]
apps/workbench/app/views/virtual_machines/_help.html.erb [moved from apps/workbench/app/views/virtual_machines/index.html.erb with 92% similarity]

index 6d013d7e268e462167aea443738cf48ea063f7ab..8d6d4949c3c1a57b9a0d9968f8b16c6711ce51ae 100644 (file)
@@ -54,7 +54,9 @@ class ApplicationController < ActionController::Base
     self.render_error status: 404
   end
 
-
+  def helper
+    (self.class.to_s.sub(/Controller$/,'')+'Helper').constantize
+  end
   def index
     @objects ||= model_class.limit(1000).all
     respond_to do |f|
index 6bbb01dc316ff931ece288428a3889bf8508e1f5..2e3d8b1efb6819721472db1ff881dcc2f5826899 100644 (file)
@@ -1,4 +1,8 @@
 class AuthorizedKeysController < ApplicationController
+  def index_pane_list
+    %w(recent setup)
+  end
+
   def new
     super
     @object.authorized_user_uuid = current_user.uuid if current_user
index 9a486f28ae37a325fe7e6a56249bfb7a6a0b9ec3..1ea45c177533fb7d36d4ebbe7d53b9310b943b74 100644 (file)
@@ -1,2 +1,5 @@
 module AuthorizedKeysHelper
+  def index_pane_list
+    %w(recent help)
+  end
 end
index 2860b5a91632501f329faf3df6a1929614250c15..c8d1590ba421e6f98f4a6ffa20c20be2c19430a3 100644 (file)
@@ -1,2 +1,5 @@
 module RepositoriesHelper
+  def index_pane_list
+    %w(recent help)
+  end
 end
index cbb398d1b9474b6d817212274ceb8d955d578356..69a3e2177c390f7fe57c0f6f611ddbfd142356f5 100644 (file)
@@ -1,2 +1,5 @@
 module VirtualMachinesHelper
+  def index_pane_list
+    %w(recent help)
+  end
 end
index 94a2b959164200e874869a8f15b6e9724e04b7c3..cdd148c0371a297de2f874511e6bf3512a7281ac 100644 (file)
@@ -13,6 +13,10 @@ class Collection < ArvadosBase
     false
   end
 
+  def self.creatable?
+    false
+  end
+
   def provenance
     $arvados_api_client.api "collections/#{self.uuid}/", "provenance"
   end
similarity index 93%
rename from apps/workbench/app/views/api_client_authorizations/index.html.erb
rename to apps/workbench/app/views/api_client_authorizations/_help.html.erb
index 03f4ea0e59c1928ee7a42f8a599ae26b8542426d..14817215352ed0296cc372b5cadeb17c8f560333 100644 (file)
@@ -12,5 +12,3 @@ export ARVADOS_API_HOST_INSECURE=true
 unset ARVADOS_API_HOST_INSECURE
 <% end %>
 </pre>
-
-<%= render partial: 'index' %>
similarity index 90%
rename from apps/workbench/app/views/application/_index.html.erb
rename to apps/workbench/app/views/application/_recent.html.erb
index 64b94c8a28ea14861c0dbe965210bb86c351b1ad..6ea381868e90e6ed6f9c2fd9d2d03f77a977f9a0 100644 (file)
@@ -1,9 +1,3 @@
-<% if controller.model_class.creatable? %>
-<%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}", 
-    { action: 'create', return_to: request.url }, 
-    { class: 'btn btn-primary pull-right' } %>
-<% end %>
-
 <% if @objects.empty? %>
 <br/>
 <p style="text-align: center">
@@ -65,4 +59,3 @@
 </table>
 
 <% end %>
-
index 6256b2848e268c7c1aacf1bff2d60969da5512a8..99cf64fcea10d9b8ebc3283ff84ef7e757c9cde5 100644 (file)
@@ -1 +1,26 @@
-<%= render partial: 'index' %>
+<% if controller.model_class.creatable? %>
+<%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}", 
+    { action: 'create', return_to: request.url }, 
+    { class: 'btn btn-primary pull-right' } %>
+<% end %>
+<%= form_tag({action: 'compare', controller: params[:controller], method: 'get'}, {method: 'get', id: 'compare', class: 'pull-right small-form-margin'}) do |f| %>
+<%= submit_tag 'Compare selected', {class: 'btn btn-primary', disabled: true, style: 'display: none'} %>
+&nbsp;
+<% end rescue nil %>
+
+<% pane_list = (controller.class.to_s.sub(/Controller$/,'')+'Helper').constantize.index_pane_list rescue %w(recent) %>
+
+<div class="tabbable">
+<ul class="nav nav-tabs">
+  <% pane_list.each_with_index do |pane, i| %>
+  <li class="<%= 'active' if i==0 %>"><a href="#<%= pane %>" data-toggle="tab"><%= pane.capitalize %></a></li>
+  <% end %>
+</ul>
+
+<div class="tab-content">
+  <% pane_list.each_with_index do |pane, i| %>
+  <div id="<%= pane %>" class="tab-pane fade in <%= 'active' if i==0 %>">
+    <%= render partial: pane %>
+  </div>
+  <% end %>
+</div>
diff --git a/apps/workbench/app/views/authorized_keys/_help.html.erb b/apps/workbench/app/views/authorized_keys/_help.html.erb
new file mode 100644 (file)
index 0000000..db4d4dc
--- /dev/null
@@ -0,0 +1,10 @@
+<p>
+  More information about how to log in to VMs:
+</p>
+<ul>
+  <li>
+    <%= link_to raw('Arvados Docs &rarr; User Guide &rarr; SSH access'),
+        "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access.html",
+        target: "_blank"%>.
+  </li>
+</ul>
index 433297780c3137ae37d1f7bfebfdf041117ece61..37e8fce13ef49e1c5d3ceff24ee1aa980cc5ecc3 100644 (file)
@@ -1,10 +1 @@
-<%= render partial: 'application/index' %>
-
-<hr />
-
-<p>
-  See also:
-  <%= link_to raw('Arvados Docs &rarr; User Guide &rarr; SSH access'),
-  "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access.html",
-  target: "_blank"%>.
-</p>
+<%= render template: 'application/index' %>
diff --git a/apps/workbench/app/views/collections/_nav.html.erb b/apps/workbench/app/views/collections/_nav.html.erb
deleted file mode 100644 (file)
index 678d8eb..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<ul class="nav nav-pills">
-  <% [['Table', collections_path],
-     ['Graph', collections_graph_path],
-     ['Inspect', @object ? collection_path(@object.uuid) : '#']].
-     each do |name, path| %>
-  <li class="<%= 'active' if request.fullpath == path %> <%= 'disabled' if path == '#' %>"><%= link_to name, path %></li>
-  <% end %>
-</ul>
similarity index 96%
rename from apps/workbench/app/views/collections/index.html.erb
rename to apps/workbench/app/views/collections/_recent.html.erb
index 7a83418c867e401ec79e21b413f28aa017e8cede..4f383f3f3a9ec4ae2c9280b1d0697f0b364d944c 100644 (file)
@@ -1,5 +1,3 @@
-<%#= render :partial => 'nav' %>
-
 <div class="pull-right">
   <%= form_tag collections_path, method: 'get', remote: true, class: 'form-search' do %>
   <div class="input-append">
index 120af6f5b6735371192feb7fcaf61ba3023dea8a..f1943c3114e36343a5978f3f845dd157a89beaf5 100644 (file)
@@ -14,8 +14,6 @@
 
 <% end %>
 
-<%#= render :partial => 'nav' %>
-
 <div class="tabbable">
 <ul class="nav nav-tabs">
   <li class="active"><a href="#files" data-toggle="tab">Files (<%= @object.files ? @object.files.size : 0 %>)</a></li>
index afa03bab728d1811e7f86963ea398147315dfdae..4b5ce2027c49f5e02e920d1ab620ad7bfe33605a 100644 (file)
@@ -22,7 +22,7 @@
   <%= yield :js %>
   <% end %>
   <style>
-    .container  {
+    body > div.container-fluid {
     padding-top: 60px; /* 60px to make the container go all the way to the
     bottom of the topbar */
     }
@@ -95,7 +95,7 @@
     </div>
   </div>
 
-  <div class="container">
+  <div class="container-fluid">
 
     <div class="body-content">
       <%= yield %>
similarity index 84%
rename from apps/workbench/app/views/pipeline_instances/index.html.erb
rename to apps/workbench/app/views/pipeline_instances/_recent.html.erb
index ad941daf5da8e33dd8f9a4cea8b8177c79f2da43..481d276e3090339a9c5906a430593168a30e244a 100644 (file)
@@ -1,10 +1,9 @@
-<%= form_tag({action: 'compare', controller: 'pipeline_instances', method: 'get'}, {method: 'get', id: 'compare'}) do |f| %>
+<%= form_tag do |f| %>
 
 <table class="table table-hover">
   <thead>
     <tr class="contain-align-left">
       <th>
-       <%= submit_tag 'Compare', {class: 'btn btn-primary', disabled: true} %>
       </th><th>
        status
       </th><th>
 <% end %>
 
 <% content_for :footer_js do %>
-$('form#compare input[name="uuids[]"]').on('click', function() {
-    var form = $('form#compare')[0]
+var showhide_compare = function() {
+    var form = $('form#compare')[0];
+    $('input[type=hidden][name="uuids[]"]', form).remove();
     $('input[type=submit]', form).prop('disabled',true);
-    $('input[name="uuids[]"]', form).each(function(){
+    $('input[name="uuids[]"]').each(function(){
         if(this.checked) {
-            $('input[type=submit]', form).prop('disabled',false);
+            $('input[type=submit]', form).prop('disabled',false).show();
+            $(form).append($('<input type="hidden" name="uuids[]"/>').val(this.value));
         }
     });
-});
+};
+$('form input[name="uuids[]"]').on('click', showhide_compare);
+showhide_compare();
 <% end %>
index 08128a1179fafe4c5209ebefc013e2a02ad64724..8739c8dc82f2efaf55d67989a667b914076488a7 100644 (file)
@@ -11,7 +11,7 @@
 }
 <% end %>
 
-<% pi_span = [(10.0/(@objects.count)).floor,1].max %>
+<% pi_span = [(10.0/[@objects.count,1].max).floor,1].max %>
 <div>
 <% [['Instance', :uuid], ['Template', :pipeline_template_uuid]].each do |label, attr| %>
 <div class="row headrow">
similarity index 94%
rename from apps/workbench/app/views/repositories/index.html.erb
rename to apps/workbench/app/views/repositories/_help.html.erb
index 564738d435e95ee1da205c5c6d6d56b3ac440d9c..2830da5ae942a5082e8b290302d907ef9cff6618 100644 (file)
@@ -1,5 +1,3 @@
-<%= render partial: 'application/index' %>
-
 <% if (example = @objects.select(&:push_url).first) %>
 
 <p>
similarity index 92%
rename from apps/workbench/app/views/virtual_machines/index.html.erb
rename to apps/workbench/app/views/virtual_machines/_help.html.erb
index 63a9f7c68251761ea6ff58f14e4a31ec2a3ae669..abf76b0148f8ac900fc5bf6708a5599724d5a4c8 100644 (file)
@@ -1,7 +1,3 @@
-<%= render partial: 'application/index' %>
-
-<hr />
-
 <p>
 Sample <code>~/.ssh/config</code> section:
 </p>